vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   vB Custom Pages (https://vborg.vbsupport.ru/showthread.php?t=207021)

GCSkye 03-01-2009 05:44 PM

vB Custom Pages
 
I noticed in vbcustom pages the following is needed to put placed in to include forum stats on the page:

PHP Code:

// get special data templates from the datastore
$specialtemplates = array(
    
'userstats'
); 

Where exactly is it pulling this from? I am hoping it will help me with the following matter:
https://vborg.vbsupport.ru/showthrea...74#post1757574

Lynne 03-01-2009 05:53 PM

If you are using a template to spit something out, then yes, it does need to be included in one of the arrays at the top of the page. I'm not sure, but your problem may be that you are trying to get the forumcount for a forum you have asked not to have post counts. So, I'm not sure if the postcounts are available for that forum in the forumcache. You'd have to check that. I know there are several threads here about getting the post counts in specific forums, you might want to try a search.

GCSkye 03-01-2009 06:16 PM

I'm trying to get forum threads and posts to all count on the forum stats at the bottom of the page regardless of forum rules.

http://evercube.net/forum/

You will notice the header thread count is different than the footer thread count. The header stats are counting all the threads on the site while the footer is only counting forums that have permission to count posts.

This is what the header is calling:

PHP Code:

$numbersmembers $db->query_first("SELECT COUNT(*) AS users,MAX(userid) AS max FROM " TABLE_PREFIX "user");   
$numbermembers number_format($numbersmembers['users']);   
$counter $db->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " TABLE_PREFIX "post");  
$totalposts=number_format($counter['posts']);   
$countthreads $db->query_first("SELECT COUNT(*) AS threads FROM " TABLE_PREFIX "thread");  
$totalthreads=number_format($countthreads['threads']); 


Mr-Moo 03-01-2009 06:20 PM

I cannot help but feel this should have been included in your other thread:
https://vborg.vbsupport.ru/showthread.php?t=207005.

I will review this and see what I can come up for you.

// Edit //

Have you attempted the following:

Find:
PHP Code:

$totalthreads 0;
$totalposts 0;
if (
is_array($vbulletin->forumcache))
{
    foreach (
$vbulletin->forumcache AS $forum)
    {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
    }
}
$totalthreads vb_number_format($totalthreads);
$totalposts vb_number_format($totalposts); 

Replace with:
PHP Code:

$counter $db->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " TABLE_PREFIX "post");  
$totalposts=number_format($counter['posts']);   
$countthreads $db->query_first("SELECT COUNT(*) AS threads FROM " TABLE_PREFIX "thread");  
$totalthreads=number_format($countthreads['threads']); 


GCSkye 03-01-2009 06:24 PM

Alright, basically all I am asking is where is the footer stats on vbulletin calling from?

If you can tell me that, just need to have them be changed to call like the header stats.

--- Edit

I'll try it

--- Edit

Thanks a bunch worked prefect.

Mr-Moo 03-01-2009 06:31 PM

Glad I could help :) You may want to post in your other thread that this issue was resolved.

Thank you!

Dismounted 03-02-2009 05:06 AM

You know that doing that will run 6 queries on forumhome, and that's not even doing much?

To answer your question, the $specialtemplates array is anything the page needs fetched from the datastore.


All times are GMT. The time now is 02:20 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.03458 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete