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: 10-25-2000 Last Update: Never Installs: 0
 
No support by the author.

Forumdisplay Optimization for vB 1.1.2 & 1.1.3 by rangersfan 2000

Open forumdisplay.php, and dont put in the dashes! As always backup forumdisplay.php in case something goes wrong.

Code:
Find this Code:
---------------
$threads=$DB_site->query("SELECT threadid,title,open,lastpost,replycount,postusername,lastposter,notes,iconid,views FROM thread WHERE forumid=$forumid AND visible=1 $datecut ORDER BY lastpost DESC LIMIT $limitlower,$perpage");
---------------

(editor note.. If you have changed this query and it no longer matches the above, the important part is to replace "iconid" with "thread.iconid", add "icon.title AS icontitle",
   add "icon.iconpath", replace "title" with "thread.title AS threadtitle" and add "LEFT JOIN icon ON (icon.iconid = thread.iconid)" after "FROM thread")

Replace with:
---------------
$threads=$DB_site->query("SELECT thread.iconid, icon.title AS icontitle, icon.iconpath,threadid,thread.title AS threadtitle,
                                 open,lastpost,replycount,postusername,lastposter,notes,views,userindex
                          FROM thread
                          LEFT JOIN icon ON (icon.iconid = thread.iconid)
                          WHERE forumid=$forumid AND visible=1 $datecut
                          ORDER BY lastpost
                          DESC LIMIT $limitlower,$perpage");
----------------

Find this code:
----------------
  if ($showicons==1 and $thread[iconid]!=0) {
    if ($icon=$DB_site->query_first("SELECT title,iconpath FROM icon WHERE iconid=$thread[iconid]")) {
      $threadicon="<img src=\"$icon[iconpath]\" alt=\"$icon[title]\" border=0>";
    } else {
      $threadicon="&nbsp;";
    }
  } else {
    $threadicon="&nbsp;";
  }
----------------

Replace with:
----------------
  $threadicon="&nbsp;";
  if ($showicons==1 and $thread[iconid]!=0)
  {
     $threadicon="<img src=\"$thread[iconpath]\" alt=\"$thread[icontitle]\" border=0>";
  }
-----------------

version 1.1.2 and version 1.1.3beta1 and 2 Find this code:
-----------------
  if ($wordwrap!=0) {
    $thread[title]=eregi_replace("([^\n\r <>\"\\-]{$wordwrap})"," \\1 ",$thread[title]);
  }
  $threadtitle=htmlspecialchars($thread[title]);
-----------------

Replace with:
-----------------
  if ($wordwrap!=0) {
    $thread[threadtitle]=eregi_replace("([^\n\r <>\"\\-]{$wordwrap})"," \\1 ",$thread[threadtitle]);
  }
  $threadtitle=htmlspecialchars($thread[threadtitle]);
-----------------

version 1.1.3beta3 find this code:
-----------------
  if ($wordwrap!=0) {
    $thread[title]=dowordwrap($thread[title]);
  }
  $threadtitle=htmlspecialchars($thread[title]);

Replace with:
-----------------
  if ($wordwrap!=0) {
    $thread[title]=dowordwrap($thread[threadtitle]);
  }
  $threadtitle=htmlspecialchars($thread[threadtitle]);
That's it! Enjoy. This will cut your queries on forumdisplay from (Num of threads on page + 6) to 6!

Also please forgive me but I have a thing about code structure and readability.

[Edited by rangersfan on 10-26-2000 at 04:43 PM]

Show Your Support

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

Comments
  #2  
Old 10-25-2000, 04:37 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by rangersfan
Also please forgive me but I have a thing about code structure and readability.
Forgive you? I think *all* queries should be structured exactly like you've done... it makes it sooo much easier to read and maintain the code that way.

Wonderful optimization by the way, I am sure this will be a very nice performance increase

-Chris
Reply With Quote
  #3  
Old 10-25-2000, 11:20 PM
Guest
 
Posts: n/a
Default

Its amazing how this could slip the cracks. I would at least have thought they would have used a caching system, or maybe one query of all icons before loading the page.

People, this hack will increase performance (if mysql is your bottleneck, as it is in my case) greatly. Get it now.
Reply With Quote
  #4  
Old 10-26-2000, 12:10 AM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Stallion
Its amazing how this could slip the cracks. I would at least have thought they would have used a caching system, or maybe one query of all icons before loading the page.

People, this hack will increase performance (if mysql is your bottleneck, as it is in my case) greatly. Get it now.
hmmmm... mysql is my problem from day one... would these instructions change if i had hacks already ?
Reply With Quote
  #5  
Old 10-26-2000, 12:12 AM
Guest
 
Posts: n/a
Default

I dont' think there are any hacks (outside of my dot hack or VirtueTech's forum display sorting) that would have changed this code.
Reply With Quote
  #6  
Old 10-26-2000, 12:26 AM
Guest
 
Posts: n/a
Default

thanks i tried it on my long forgotten private testing vB which has the poll hack added also... seems to work.. gonna add it to my forums once i finish defragging my other pc with my working copy of my site files
Reply With Quote
  #7  
Old 10-26-2000, 02:47 AM
Guest
 
Posts: n/a
Default

great stuff rangersfan with me lowering my join buffers and adding this optimisation i survived my first forum peak hour without needing to reboot my server
Reply With Quote
  #8  
Old 10-26-2000, 12:46 PM
Guest
 
Posts: n/a
Default

Quote:
Find this code:
-----------------
if ($wordwrap!=0) {
$thread[title]=eregi_replace("([^\n\r <>\"\\-]{$wordwrap})"," \\1 ",$thread[title]);
}
$threadtitle=htmlspecialchars($thread[title]);
-----------------

Replace with:
-----------------
if ($wordwrap!=0) {
$thread[threadtitle]=eregi_replace("([^\n\r <>\"\\-]{$wordwrap})"," \\1 ",$thread[threadtitle]);
}
$threadtitle=htmlspecialchars($thread[threadtitle]);
-----------------
[/code]
Hi,

I have looked thru all files and cannot find the above statement. I have vb 1.1.3 too.
Reply With Quote
  #9  
Old 10-26-2000, 02:17 PM
Guest
 
Posts: n/a
Default

I will try this out after the major update!
Reply With Quote
  #10  
Old 10-26-2000, 02:24 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by vBoard.co.uk
I will try this out after the major update!
Well, hopefully, any update would have this in it already.
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 11:55 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.04225 seconds
  • Memory Usage 2,269KB
  • 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
  • (1)bbcode_code
  • (4)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