Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-06-2000 Last Update: Never Installs: 0
 
No support by the author.

Let us know what you think ...

Replace the makeforumjump section in global.php with this
hold your breath and pray ! (it joins 2 sql queries into one - we've got it running on forums.gameplay.com ;-) )

also downloadable from http://forums.gameplay.com/global_hack_pt1.html
(err yes there is at least another one on it's way ...)

fodder


// ###################### Start makeforumjump #######################
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"];
}
}

$categorys = $DB_site->query ("SELECT category.categoryid, category.title as ctitle, category.displayorder , forum.forumid, forum.title as ftitle, forum.displayorder FROM category,forum WHERE forum.categoryid=category.categoryid AND forum.displayorder <>0 and category.displayorder<>0 and forum.active=1 order by category.displayorder, forum.displayorder");

$this_cat=0;
$old_categoryid=0;
$old_ctitle="";

while ($category = $DB_site->fetch_array ($categorys))
{
$forum=$category;

if ( $this_cat != $category["categoryid"] )
{
if ($this_cat >0)
{
if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");

if ($curforumid == "cat$old_categoryid")
{
$optionselected = "selected";
} $jumpforumid = "cat$old_categoryid";
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");

$optionselected = "";

$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;
}

$optionselected = "";
$forumshown = 0;
$tempjumpforumbits = "";
$this_cat = $category["categoryid"];
$old_categoryid = $this_cat;
$old_ctitle=$category["ctitle"];
}

if ($hideprivateforums == 1)
{
$getperms = getpermissions ($bbuserid, $bbusergroupid, $forum["forumid"]);
}
else
{
$getperms["canview"] = 1;
}

if ($getperms["canview"] == 1)
{
$forumshown = 1;

$jumpforumid = $forum["forumid"];
$jumpforumtitle = " " . $forum["ftitle"];
else
{
$optionselected = "";
}
eval ("\$tempjumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
} // end if $getperms...
}


if ($usecategories == 1 and $forumshown == 1)
{
$jumpforumid = "";
$jumpforumtitle = "";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");

//if ($curforumid == "cat".$category["categoryid"])
if ($curforumid == "cat$old_categoryid")
{
$optionselected = "selected";
}
// $jumpforumid = "cat" . $category["categoryid"];
$jumpforumid = "cat$old_categoryid";
// $jumpforumtitle = "Category: " . $category["ctitle"];
$jumpforumtitle = "Category: $old_ctitle";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");

$optionselected = "";

$jumpforumid = "";
$jumpforumtitle = "--------------------";
eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";");
}
// add forum bits
$jumpforumbits.= $tempjumpforumbits;


if ($selectedone != 1)
{
$defaultselected = "selected";
}
eval ("\$forumjump = \"".gettemplate ("forumjump")."\";");
}

if ($curforumid == $jumpforumid)
{
$optionselected = "selected";
$selectedone = 1;
}

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 09-06-2000, 03:53 PM
Guest
 
Posts: n/a
Default

fodder has this hack and the showthread hack helped your forum speed?
Reply With Quote
  #3  
Old 09-06-2000, 04:01 PM
Guest
 
Posts: n/a
Default

Seems to.

The main thrill about is is that it reduces the load on the database server.

We have about 1.1 million posts these days so anything that makes our db server's life easier
is very welcome !

in summary what it does is compress the category select in with the forum select so that
you are only doing one sql query rather than 1+ number of forums in your db ..

It helps a bit

The next hack ( coming in about 10 mins ) also does help the db loading.

If you want to see the difference tell mysql to do logging tail the log and
compare the two.

The next hack makes that test look very very very very scary indeed

fodder
Reply With Quote
  #4  
Old 09-06-2000, 04:26 PM
Guest
 
Posts: n/a
Default

There are a couple errors in your code involving extra and missing brackets so I wonder how you are running it. Here is a "fixed" version as in it seems to work

Code:
// ###################### Start makeforumjump ####################### 
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"]; 
     } 
   } 

   $categorys = $DB_site->query ("SELECT category.categoryid, category.title as ctitle, category.displayorder , forum.forumid, forum.title as ftitle, forum.displayorder FROM category,forum WHERE forum.categoryid=category.categoryid AND forum.displayorder <>0 and category.displayorder<>0 and forum.active=1 order by category.displayorder, forum.displayorder"); 
   $this_cat=0; 
   $old_categoryid=0; 
   $old_ctitle=""; 

   while ($category = $DB_site->fetch_array ($categorys)) 
   { 
      $forum=$category; 

      if ( $this_cat != $category["categoryid"] ) 
      { 
         if ($this_cat >0) 
         { 
            if ($usecategories == 1 and $forumshown == 1) 
            { 
               $jumpforumid = ""; 
               $jumpforumtitle = ""; 
               eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 

               if ($curforumid == "cat$old_categoryid") 
               {  $optionselected = "selected";   } 
               $jumpforumid = "cat$old_categoryid"; 
               $jumpforumtitle = "Category: $old_ctitle"; 
               eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
               $optionselected = ""; 
               $jumpforumid = ""; 
               $jumpforumtitle = "--------------------"; 
               eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
            } 
            // add forum bits 
            $jumpforumbits.= $tempjumpforumbits; 
         } 

         $optionselected = ""; 
         $forumshown = 0; 
         $tempjumpforumbits = ""; 
         $this_cat = $category["categoryid"]; 
         $old_categoryid = $this_cat; 
         $old_ctitle=$category["ctitle"]; 
     }
     if ($hideprivateforums == 1) 
     {  $getperms = getpermissions ($bbuserid, $bbusergroupid, $forum["forumid"]); } 
     else 
     {  $getperms["canview"] = 1; } 

     if ($getperms["canview"] == 1) 
     { 
        $forumshown = 1; 
        $jumpforumid = $forum["forumid"]; 
        $jumpforumtitle = " " . $forum["ftitle"]; 
     }
     else 
     {  $optionselected = ""; } 
     eval ("\$tempjumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
   } // end if $getperms... 
 
   if ($usecategories == 1 and $forumshown == 1) 
   { 
      $jumpforumid = ""; 
      $jumpforumtitle = ""; 
      eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
 
      //if ($curforumid == "cat".$category["categoryid"]) 
      if ($curforumid == "cat$old_categoryid") 
      {  $optionselected = "selected";    } 
      // $jumpforumid = "cat" . $category["categoryid"]; 
      $jumpforumid = "cat$old_categoryid"; 
      // $jumpforumtitle = "Category: " . $category["ctitle"]; 
      $jumpforumtitle = "Category: $old_ctitle"; 
      eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
      $optionselected = ""; 
      $jumpforumid = ""; 
      $jumpforumtitle = "--------------------"; 
      eval ("\$jumpforumbits .= \"".gettemplate ("jumpforumbit")."\";"); 
   } 

   // add forum bits 
   $jumpforumbits.= $tempjumpforumbits; 

   if ($selectedone != 1) 
   {   $defaultselected = "selected"; } 
   eval ("\$forumjump = \"".gettemplate ("forumjump")."\";"); 

   if ($curforumid == $jumpforumid) 
   { 
      $optionselected = "selected"; 
      $selectedone = 1; 
   } 
}
Reply With Quote
  #5  
Old 09-06-2000, 04:33 PM
Guest
 
Posts: n/a
Default

which bits did you change ?
my eyes are going !

it might have been the cut and paste
is the web page one better ?

fodder
Reply With Quote
  #6  
Old 09-06-2000, 04:33 PM
Guest
 
Posts: n/a
Default

Also what is the point of this code which comes at the end of the function, is not returned from the function and occurs after all templates are set. I can see it hopes to set the combobox to display the current forum but has little hope of working coming after the template. This code needs to be checked over closely before being installed. IMHO

Code:
   if ($curforumid == $jumpforumid) 
   { 
      $optionselected = "selected"; 
      $selectedone = 1; 
   }
Reply With Quote
  #7  
Old 09-06-2000, 04:36 PM
Guest
 
Posts: n/a
Default

I gave up waiting on your web page version to load but I just looked at it and it is different than your pasted one!

Quote:
Originally posted by fodder
which bits did you change ?
my eyes are going !

it might have been the cut and paste
is the web page one better ?

fodder
Reply With Quote
  #8  
Old 09-06-2000, 04:39 PM
Guest
 
Posts: n/a
Default

It might be my eyes but I think that that comes just before
an eval statement ...?

Fodder
Reply With Quote
  #9  
Old 09-06-2000, 04:40 PM
Guest
 
Posts: n/a
Default

Look at the end of the code you pasted - it comes after the eval and also notice you don't close the function off with a }
Reply With Quote
  #10  
Old 09-06-2000, 04:42 PM
Guest
 
Posts: n/a
Default

Like I said the cut and paste may have gone wrong

Try the downloadable version from the URL given

http://forums.gameplay.com/global_hack_pt1.html

That has a greater chance of being right ...

Fodder
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:27 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04099 seconds
  • Memory Usage 2,286KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete