function makeforumjump()
{
// this generates the jump to box
global $DB_site,$forumid,$optionselected,$usecategories, $jumpforumid,$jumpforumtitle, $jumpforumbits,$curforumid;
global $hideprivateforums,$defaultselected, $forumjump,$bbuserid,$bbusergroupid;
if ($forumid!="")
{
$curforumid=$forumid;
}
else
{
if ($threadid!="")
{
$getforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid=$threadid");
$curforumid=$getforumid[forumid];
}
}
$forums=$DB_site->query("SELECT category.categoryid, category.title AS categorytitle,
forumid, forum.title AS forumtitle
FROM category
LEFT JOIN forum ON (category.categoryid = forum.categoryid)
WHERE category.displayorder<>0 AND forum.displayorder <> 0 AND active=1
ORDER BY category.displayorder, forum.displayorder");
$firstcat = 0;
while ($forum=$DB_site->fetch_array($forums))
{
$currentcat = $forum[categoryid];
if ($usecategories == 1)
{
$optionselected="";
if ($firstcat != $currentcat) // Print Category
{
$firstcat = $forum[categoryid];
// This creates our "blank line" in the dropdown
$jumpforumid="";
$jumpforumtitle="";
eval("\$jumpforumbits .= \"".gettemplate("jumpforumbit")."\";");
$jumpforumid="cat$forum[categoryid]";
$jumpforumtitle="Category: $forum[categorytitle]";
eval("\$jumpforumbits .= \"".gettemplate("jumpforumbit")."\";");
$jumpforumid="";
$jumpforumtitle="--------------------";
eval("\$jumpforumbits .= \"".gettemplate("jumpforumbit")."\";");
}
}
if ($hideprivateforums==1)
{
$getperms=getpermissions($bbuserid,$bbusergroupid,$forum[forumid]);
}
else
{
$getperms[canview]=1;
}
if ($getperms[canview]==1)
{
$jumpforumid=$forum[forumid];
$jumpforumtitle=" $forum[forumtitle]";
if ($curforumid==$jumpforumid)
{
$optionselected="selected";
$selectedone=1;
}
eval("\$jumpforumbits .= \"".gettemplate("jumpforumbit")."\";");
}
}
if ($selectedone!=1)
{
$defaultselected="selected";
}
eval("\$forumjump = \"".gettemplate("forumjump")."\";");
}
For the record the current forumjump retrieves a list of categories. Then for each record in that result set it runs a query of the forums that belong to that category. Have 50 categories, you have 51 queries. Now you would have 2. We still need to do something about that "getperms" function as it will run a query each time per forum. How about we retrieve that information along with the bbusername, bbpassword, bbuserid and have it available instead of constantly retrieveing it all the time. Just a thought.
[Edited by Ed Sullivan on 10-27-2000 at 05:45 PM]
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Originally posted by rangersfan
The forum has inserted a space from the damned wordwrap bug.
Actually, ironically, that's not the bug. Put spaces between your commas and you'll find it's fine. [I'll go do that real quick] FYI, John fixed the bug. 1.1.4 will have the fix.
Also, when I get around to it, I think I'll swipe rangersfan's sig too It makes sense, and gets rid of a lot of those "[request] WHERE IS IT?" threads.