PDA

View Full Version : Alphabetize forum listing


knucklenitz
06-20-2009, 04:58 AM
Hi -

I've seen a few old postings on alphabetizing the forum listing but no solution that I found.

My main page has a whole list of forums with sub-forums under each. Is there a way to automatically (or add a user selected option) to alphabetize the listing?

Thanks!

Carnage
06-21-2009, 09:50 AM
Do you want it done permanently for all users?

if so something along the lines of


$q = $db->query('select * from forums order by title');
$i = 0;
while($row = $db->fetch_array($q))
{
$i++;
$db->query("UPDATE forum SET order = $i WHERE forumid = $row[forumid]");
}

rebuilt_forums_cache();


UNTESTED and is only meant to serve as an example. It will need some work to get it to work correctly

knucklenitz
06-23-2009, 04:46 AM
Thanks.

How can I test this without potential damage to my site? Is there a way to do offline testing? Sorry to be lame.

Dismounted
06-23-2009, 07:53 AM
How can I test this without potential damage to my site? Is there a way to do offline testing? Sorry to be lame.
As per the license agreement, you are allowed a test board in a directory called testvb. This directory must not be publicly accessible (e.g. password protected with .htaccess).