Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives

Reply
 
Thread Tools
queries in my phpinclude template Details »»
queries in my phpinclude template
Version: , by corsacrazy corsacrazy is offline
Developer Last Online: May 2010 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 04-16-2003 Last Update: Never Installs: 0
 
No support by the author.

ok ! i hav some stats in my header ! so to generate them ive used the phpinclude template so therefore my stats show on every page of forums . i know for a fact these stats add 10 queries therefor 10 queries to EVERYPAGE

what php FILE shall i move these queries to from my phpinclude template so it shows on everypage ? is it funcions.php ? by doing this will it reduce query count ? thanks in advance

Show Your Support

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

Comments
  #2  
Old 04-16-2003, 10:36 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you should put it into global.php
but no it wouldn reduce the ammount of queries, just the position of them ^^

you should optimize the stats to reduce the queries...
Reply With Quote
  #3  
Old 04-16-2003, 11:01 AM
corsacrazy's Avatar
corsacrazy corsacrazy is offline
 
Join Date: May 2002
Location: london
Posts: 854
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any ideas on how to optimise the stats ?
Reply With Quote
  #4  
Old 04-16-2003, 01:25 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

10 queries on every page? For stats? Not worth it... something isn't right. Post your queries here.
Reply With Quote
  #5  
Old 04-16-2003, 01:58 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

maybe we can optimize it, but as Erwin said you have to post them or we don't know
Reply With Quote
  #6  
Old 04-16-2003, 03:35 PM
corsacrazy's Avatar
corsacrazy corsacrazy is offline
 
Join Date: May 2002
Location: london
Posts: 854
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

k

this is my php include template

// This code is PHP4 only:
// ob_start();
// require("yourheader.html");
// $header = ob_get_contents();
// ob_end_clean();
include("vbs_counter.php");
// Lets query the DB for post count.
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
// For threads.
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
// For members
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
// End Advanced header info (mod by Anime-loo)

$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];

// Top poster
$topposters=$DB_site->query_first("SELECT username,posts,userid FROM user ORDER BY posts desc LIMIT 1");

// number of posts today
$datecut = mktime(0,0,0,date("m"), date("d"), date("y"));
$getpoststoday=$DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline>='$datecut'");
$poststoday=$getpoststoday[count];

if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
$totalchars = $DB_site->query("SELECT SUM(LENGTH(pagetext)) AS totalchars FROM post");
$totalchars = $DB_site->fetch_array($totalchars);
$totalchars = number_format($totalchars['totalchars']);
}
$usersig = bbcodeparse2($bbuserinfo[signature], "1", "1", "1", "1");

// number of posts yesterday
$datecut = mktime(0,0,0,date("m"), date("d"), date("y"));
$getpostsyesterday=$DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline<='$datecut' AND dateline>=".($datecut-24*3600));
$postsyesterday=$getpostsyesterday[count];
Reply With Quote
  #7  
Old 04-16-2003, 11:56 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ouch ^^

well the total post count and total thread count can be combined into one, look into my optimizing forumhome hack.

the newest user should be cached

the sum postchars is a very slow query and shouldn't be there at all...

i don't think those stats are really needed and should be removed at all for performance issues...
Reply With Quote
  #8  
Old 04-17-2003, 12:02 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why have these stats on EVERY page??? Just have it in your index.php on the forumhome. Even then, too many stats.
Reply With Quote
  #9  
Old 04-17-2003, 08:05 AM
corsacrazy's Avatar
corsacrazy corsacrazy is offline
 
Join Date: May 2002
Location: london
Posts: 854
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tru i will be sad to see them go if i just want these to appear on forumhome which file do i add these to index.php ?
Reply With Quote
  #10  
Old 04-17-2003, 08:09 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes. index.php. As long as members don't miss it, and your server doesn't suffer.
Reply With Quote
Reply

Thread Tools

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 05:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05753 seconds
  • Memory Usage 2,281KB
  • 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)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_onlinestatus
  • (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
  • postbit_imicons
  • 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