Log in

View Full Version : Alphabetize thread list order in single forum


Cyn
05-04-2003, 08:14 PM
I want to sort the thread display of one single forum by alphabetical order.
Having tried this suggestion https://vborg.vbsupport.ru/showthread.php?s=&threadid=42383 I think I'm misunderstanding the placement of the code.

Finding this in forumdisplay.php:

switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
break;

default:
$sortfield='lastpost';
}


it says to replace $sortfield='lastpost'; with $sortfield='title';

and to limit it to one forum it says replace it with an if-clause:

if($foruminfo[forumid]==x) $sortfield='title';
elseif($foruminfo[forumid]==y) $sortfield='rating';
else $sortfield='lastpost';



Since I don't want any sorting by rating I did this:

switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
break;


default:

if($foruminfo[forumid]==163) $sortfield='title';
else $sortfield='lastpost';
}

But I'm getting a parse error with it. Can someone point out my error?

filburt1
05-04-2003, 08:23 PM
You need to be much more specific as to the error...

Cyn
05-04-2003, 08:49 PM
I typed in in manually and now I'm not getting a parse error. But it's not putting the thread in alphabetical order. Take a look:
http://216.92.20.151/discussions/forumdisplay.php?s=&forumid=163

Tigga
05-04-2003, 09:54 PM
It would help if unregistered guests could view the forum. ;)

Cyn
05-05-2003, 08:20 AM
Sorry. It's open for guests now. :)

Xenon
05-05-2003, 05:41 PM
hmm, i don't see a parse error, also normally this code above shouldn't produce any error

Cyn
05-05-2003, 07:31 PM
I rewrote it manually (before I had cut and pasted) and now it's not giving me an error. But it's not alphabetizing the threads so basically it's not doing what I need it to do. Any suggestions?

Xenon
05-06-2003, 04:07 PM
be sure, that no sortfield isn't set already in the url or somewhere ;)

Cyn
05-07-2003, 04:10 PM
Can you be more specific? What should I look for and where?

Xenon
05-09-2003, 10:52 AM
if sortfield=bla bla is specified in the url or in the code before the switch

Cyn
05-11-2003, 06:48 AM
This is all I can find related to sort field in that section of the code before the switch, and right after:



// look at sorting options:
if (!isset($sortorder)) {
$sortorder = "";
}
if (!isset($sortfield)) {
$sortfield = "";
}

if ($sortorder!='asc') {
$sqlsortorder='DESC';
$order['desc']='selected';
} else {
$sqlsortorder='';
$order['asc']='selected';
}
switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
break;


default:
if($foruminfo[forumid]==163) $sortfield='title';
else $sortfield='lastpost';
}


if ($sortfield=="voteavg" and !$foruminfo[allowratings]) {
$sortfield="lastpost";
}

$sort = array();
$sort[$sortfield]='selected';

Trigunflame
05-11-2003, 08:55 AM
im thinking.. i havnt looked at the files so u might have to just take this and modify it or get an idea.. i would put this like right where the query is to fetch the threads for that forumid and use the default query there for else


$TheForumIdYouWantAbc = 1;
if($foruminfo[forumid] == $TheForumIdYouWantAbc) {
$DB_site->query("the query is right here, but modify it to ORDER BY title ASC")
}else{
$DB_site->query("the default query here"):
}


if i understand what ur asking right...that should do it.

Cyn
05-12-2003, 11:39 AM
I appreciate your help Dusty, but I'm afraid that's a little too over my head. I don't quite get what you're suggesting I do though I know where you're talking about doing it. :classic: