View Full Version : Threads number of a certain ctegory in forumhome
Triky
02-23-2009, 08:48 AM
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 1235422599 at 1235422599 ---------------
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?
// 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
$cats = array(10, 27);
$count = 0;
foreach ($cats AS $cat)
{
$count += $vbulletin->forumcache["$cat"]['threadcount'];
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.