MyBB Community Forums

Full Version: Call Thread Count For index categories
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

On my index page, I have three categories, Music, Resources and Classifieds.

As you can see in the pic below

Music category has 3 topics,
Resources category has 0 topics
and the Classifieds category has 0 topics

I am replacing the index page with a table that has three columns.
A column for Music,
a column for Resources and
a column for Classifieds,
as you can see in the pic below.

What I need to do is, figure out the function that calls the thread count for each category.
So I can put the thread count of each category in appropriate column

See example pic below.

Is there a funtion available or conditionaI I can use to call the thread count for each category.
Music, Resources and Classifieds?

[Image: 1treampletheadcount.png]


I've been trying to figure this out for a couple of days,
I would appreciate any help
if anyone can give me a point in the right direction, I woul be eternally grateful.

Thanks.
p.s. I have the plugin PHP in Templates and Template Conditionals plugin installed
You're going to want to use the build_forumbits function. You'll then have something like this:
$forum_1_info = build_forumbits(1);
$threads = $forum_1_info['counters']['threads'];
(2014-11-03, 08:22 PM)dragonexpert Wrote: [ -> ]You're going to want to use the build_forumbits function.    You'll then have something like this:

$forum_1_info = build_forumbits(1); 
$threads = $forum_1_info['counters']['threads'];

Hi Dragon!

I'm so grateful for your valuable time and knowledgable response, thank you so very much for pointing me in the right direction, I can't wait to impliment this change, You are an A+coder!
Again, thank you so much!

Hey, I'm just curious but does this look right to you?
<?php $forum_1_info = build_forumbits(1); ?>
<?php $threads = $forum_1_info['counters']['threads']; ?>
You actually don't need to close the PHP delimiter at all. You just need to open it at the start of the file.
Once again, my deepest appreciation extends, I really got the hang of it now so the extra pointer you gave me helped immensely, Thanks somuch Dragon, you are awesome!

Hi dragon, or anyone
I don't want to keep bugging you but I've been working on this all day and I cannot seem to get it going, maybe a little pointer in the right direction? It would be really appreciated,
here is what I've done so far.

#1 I've placed:
$forum_1_info = build_forumbits(1);
$threads = $forum_1_info['counters']['threads'];

here into the file called functions_forumlist.php
as seen in the pic below
[Image: 1examplefunctions.png]


#2 I've build the call function as:
{$forum_1_info['counters']['threads']}


Although I've tried many different ways, nothing seems to be working. Nothing is showing up.
I've been on this for hours and still, I just can't nail it down. Could you tell me what I'm doing wrong, because I know I'm so close, so close and your expert opinion would make all the difference,
in all regards, I really appreciate all the help you have given, it is more than I could ever ask for.

Hey guys,
I need to bump this thread because it is something I've been working on for a week and I'm hoping an expert can look over my formula above because I can't seem to get this working. Any help would be greatly appreciated
You aren't suppose to place that code in the /inc/functions_forumlist.php file. That should be either in your index.php file, or a plugin function that hooks to index_start.
Hi Dragon, thanks for replying, I already know that you have helped more than I can ever ask for,so my deepest appreciation extends, the sad part is, even with all your awesome suggestions, I cant get the counter to show up, the even sadder part is, I know that I am so close,.. so close.


Here is the appropriate function placed in the index.php
[Image: 1counterexamplee.png]

and here is the call, in the index template.
[Image: 1counterexample.png]

And here is what Ithink I'm doing wrong:
I'm placing this variable to call the counter ->{$forum_1_info['counters']['threads']}

All I can say is hm...
Well, I juast remembered a plugin that works similarly (other layout, but can change it in templates): http://mods.mybb.com/view/imp-forums It's for 1.6 but changing the compatibility should make it work in 1.8 too.
Thanks guys, awesome! Both of you have helped me immensely and I'm absolutely appreciative! I think that the mod will work! I will toy with it on my cloned site and see if I can get it going, this is going to be great!