PDA

View Full Version : Possible to sort one forum by thread start date?


jcroft
Mon 24th Sep '01, 3:37pm
Is there a way to make just one forum sort itself by thread start date, rather than by the last post date? If not, I think this would be a worthy option for a future version.

I am using a forum as my "news" section on my site, and I would like to always have the most recent news at the top of the thread, even if someone has replied to an older news item. I would like them to always be listed in the order I posted them...

Any clues?

Thanks in advance...

Chen
Mon 24th Sep '01, 3:43pm
Ok, see this in forumdisplay.php?
switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
break;

default:
$sortfield='lastpost';
}
Replace it with this:
switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
break;

default:
$sortfield='lastpost';
}
if ($forumid=="X") {
$sortfield="dateline";
}
where X is the ID of the forum you want this forum.

Not fancy, I know, but should work. :)

jcroft
Mon 24th Sep '01, 6:27pm
It worked! Thanks so mcuh...again you help me out. I should pay you, man.

One quick question, though. If I want to do this on two different forums, should I just duplicate the code, a la:

if ($forumid=="51") {
$sortfield="dateline";
}


if ($forumid=="52") {
$sortfield="dateline";
}

Or is there some way to do:


if ($forumid=="51" OR "52") {
$sortfield="dateline";
}

What's the best way to do that?

Chen
Tue 25th Sep '01, 10:03am
if ($forumid=="51" or $forumid=="52") {
$sortfield="dateline";
}
Do you want an address, to send me money? :D j/k