vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Threads number of a certain ctegory in forumhome (https://vborg.vbsupport.ru/showthread.php?t=206317)

Triky 02-23-2009 08:48 AM

Threads number of a certain ctegory in forumhome
 
Hello, I have two hidden categories, and I want to put something like this in my forumhome:

Total thread in Hidden Categoy: (*)
Total thread in Hidden Category n.2: (*)

where (*) is the threads number.
Can you please help me?

Lynne 02-23-2009 02:43 PM

Is this on the index page? Just grab it from where it says "// get total threads & posts from the forumcache" at the bottom of index.php. It's in the cache and get's totally up there. Just add in some code to grab it for each of those forumids.

lazyseller 02-23-2009 02:55 PM

Create plugin with "forumhome_complete"

$cat1 = $vbulletin->forumcache['typeforumidhere']['threadcount'];
$cat2 = $vbulletin->forumcache['typeforumidhere2']['threadcount'];

See if that works

Triky 02-23-2009 06:50 PM

Thank you. That works for one forum id. But.. if I want to add them for multiple forums? I have tried this:

$cat1 = $vbulletin->forumcache['10,27']['threadcount'];

But it doesn't work.

--------------- Added [DATE]1235422599[/DATE] at [TIME]1235422599[/TIME] ---------------

Quote:

Originally Posted by Lynne (Post 1752352)
Is this on the index page? Just grab it from where it says "// get total threads & posts from the forumcache" at the bottom of index.php. It's in the cache and get's totally up there. Just add in some code to grab it for each of those forumids.

Do you mean this part?

PHP Code:

// get total threads & posts from the forumcache
$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); 

But.. how do I modify it in order to call just some forum ids? Also.. wich variable will I use to call the number in my FORUMHOME template?

Lynne 02-23-2009 07:02 PM

Get them individually. If you then need the total for the two, just do an equation $cattotal = $cat1 + $cat2; .

Dismounted 02-24-2009 04:30 AM

PHP Code:

$cats = array(1027);
$count 0;

foreach (
$cats AS $cat)
{
    
$count += $vbulletin->forumcache["$cat"]['threadcount'];




All times are GMT. The time now is 07:10 AM.

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.01182 seconds
  • Memory Usage 1,729KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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