Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Ok ... first I will preface this to say I am VERY new to this whole hacking thing, and I dont understand any of it ... just ask Josh. hehehe

For most of my forums on my sites I want to have the normal topic order as the default view ... newest topics with replies on top, etc. However, there are certian forums that I want to have different, or unique topic viewing.

1) I would like to have topics in order of when the initial post starter was made (newest to oldest). For instance, this would be for news. So, the most recent news post would be on top. Right now, if a person replies to a news topic that is from 2 weeks ago, it puts that on top of the listing, and that is not what I want.

2) I would like to have topics ordered by alpha (A - Z). This would be for a databased style forum. The order would not change when replies are added. For instance, for my gaming site, each topic would be the name of a game and in alpha order ... like:

RalliSport Challenge
Rally Fusion: Race Of Champions
Rayman Arena
RedCard Soccer 2003
Roller Coaster Tycoon
Run Like Hell

etc.....

Thanks! I am sure I will have more questions as we go along. I am still unsure exactly everything that I want to do with the structure, but this will be a good start.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That is doable.

I did something similar for Coy7 at www.IyariLimon.com

Bascially you're going to hack around in postlist.php

Haven't looked at any code, but here's my guess.

For number one, I would add an "if" statement to override the "dateslip" check. The way you describe in #1 is how it functions with dateslip off. The posts stay in their order.

For number 2, you'd use an "if" statment, to see if it's a certain board, you'll alter the "ORDER BY" line of the query.

It would change to
"ORDER BY t1.B_Subject ASC"
I believe.

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
You can easily sort a forum alphabetically by subject by clicking the SUBJECT link in the topic page (postlist).

Here is the URL to sort this forum alpha, ascending:

Code
<br />https://ubbdev.com/forum/postlist.php?Cat=&Board=php&page=0&view=collapsed&sb=2&o=<br />


So you could just append the extra "&page=0&view=collapsed&sb=2&o=" to the URL for those forums you want sorted in this fashion in to your UBBTHREADS.TMPL file.

In UBBTHREADS.TMPL find:
Code
<br /><a href="{$config['phpurl']}/postlist.php?Cat=$Cat&amp;Board={$forum[$c][$f]['Keyword']}"><br />


Change it to:
Code
<br /><a href="{$config['phpurl']}/postlist.php?Cat=$Cat&amp;Board={$forum[$c][$f]['Keyword']}{$forum[$c][$f]['SortBy']}"><br />


$forum is an multi-dimensional array that holds display and organization info about each forum. We are going to add an entry in that array called "SortBy" and stick our sort info in it, and then append it to the URL on the forums page.

Then open UBBTHREADS.PHP and find:
Code
<br />$forum[$x][$y]['Keyword'] = $Keyword;<br />


After that add:
Code
<br />if ($Keyword == "XXXX") {<br />    $forum[$x][$y]['SortBy'] = "&page=0&view=collapsed&sb=2&o=";<br />}<br />else {<br />    $forum[$x][$y]['SortBy'] = "";<br />}<br />


Replace XXXX with the Keyword of the forum you want to sort. If you want to sort more than one forum alphabetically by subject, the just change the "if" statement to:
Code
<br />if (($Keyword == "XXXX") || ($Keyword == "YYYY")) {<br />


That will make is so that the forums identified by the keywords you specify will be sorted alpha, ascending when the user clicks on the link to open the forum.

Hope that helps!





"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Thanks. I am not up to speed today, so I am going to wait until I have a clear head before I try this ... I will post back here when I do with more questions or response.

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
No worries. Let me know if you need help.


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Sponsored Links
Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Ok .. bringing a topic up from the past (forgot about this).

This worked, thanks.

NOW ... what about:

Another option I am looking into is having a forum stay in order of date and time the initial topic post is created, but still allow people to reply. I want people to be able to reply to the topic and always be able to , but if someone replies to a topic from last month, it will bump it up to the top above more recent topics, and I do not want that. Basically, I want most recent topics created (not replied to) at top , decending to the last one created. This would only be for a couple forums, not all... for instance, a site news forum. I do not want to do this to all the forums.

Thanks.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Basically you want to shut dateslip off on a per forum basis.

This should work -in postlist.php - after the get_input stuff.

Code
<br />if ($Board == "keyword") {<br />   $config['dateslip'] = 0;<br />}<br />


Where I have "keyword" use the real keyword for the board. Then the posts will remain in order by date posted. (Dateslip will be off in that forum. )

Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Hey Josh, can you point me where specifically I need to put that? Do I need to replace anything? Also, what about multiple forums that I want that for?

Thanks man.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Add it after the get_input lines at the top. After this:

$o = get_input("o","both");



If you have more than one board -

if (($Board == "keyword") || ($Board == "keyword2")) {

instead of that other "if" line I posted.

Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Thanks Josh! Can I bug you for ONE MORE THING ?

I want to change the "Subject Poster Views Replies Last post" links to just text ... meaning that since I am forcing the way each forum is being viewed, those do not need to be "clickable" and changable, but the text needs to be there for column labelling. I am assuming I edit the postlist.tmpl deal, but I cannot figure out what to edit out without screwing it up.

Help please?

Thank you.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
In the postlist.tmpl - it's plain HTML, you'll find each comment has code like this:

<a href="{$config['phpurl']}/postlist.php?Cat=$Cat&Board=$Board&page=$page&view=$view&sb=$sortsubject&o=$o">
{$ubbt_lang['SUBJECT_TEXT']}
</a>


Remove the <a href..... > part and the </a> from each column heading.

Joined: Apr 2003
Posts: 30
User
User
Joined: Apr 2003
Posts: 30
Thanks ... I was doing that in a text editor, and it wasn't working, so I just did it via the control panel and it works.

Thanks again for your help!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)