Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Need a global for total posts of some forums in category_list

Quote Reply
Need a global for total posts of some forums in category_list
Hi,

I don't want to count the total posts and total threads of some forums in the category_list.html template. On the main index of my forum, it's written:

x membres | y threads | z posts

Here what I want to do:

for the threads count: <%total_threads - (total threads of some forums)%>

and for the posts count: <%total_posts - (total posts of some forums)%>

Thank you very much!

François

Last edited by:

Franco: Nov 3, 2002, 7:32 AM
Quote Reply
Re: [Franco] Need a global for total posts of some forums in category_list In reply to
Hi François,

Here are a couple globals you can use to get the threads and posts of a particular forum, given its forum_id:

threads_in_forum:

Code:
sub { $DB->table('Forum')->select(forum_total_threads => { forum_id => shift })->fetchrow }

posts_in_forum:

Code:
sub { $DB->table('Forum')->select(forum_total => { forum_id => shift })->fetchrow }
Then in your template, you'll do:

<%set show_threads = $total_threads%>
<%set show_threads -= threads_in_forum(4)%>
<%set show_threads -= threads_in_forum(9)%>
<%set show_threads -= threads_in_forum(15)%>

Now use <%show_threads%> instead of <%total_threads%> - it will have the count subtracted. Replace 4, 9, and 15 with the ID's of whichever forums whose counts you wish to subtract.

Likewise, for the post count:

<%set show_posts = $total_posts%>
<%set show_posts -= posts_in_forum(4)%>
<%set show_posts -= posts_in_forum(9)%>
<%set show_posts -= posts_in_forum(15)%>

Then use <%show_posts%> instead of <%total_posts%>. Again, replace 4, 9, and 15 with the desired forum ID's.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Need a global for total posts of some forums in category_list In reply to
Thank you very much, Jason!! Smile

François