Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Re: [Franco] Need a global for total posts of some forums in category_list

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
Subject Author Views Date
Thread Need a global for total posts of some forums in category_list Franco 1839 Nov 3, 2002, 7:30 AM
Thread Re: [Franco] Need a global for total posts of some forums in category_list
Jagerman 1774 Nov 3, 2002, 1:57 PM
Post Re: [Jagerman] Need a global for total posts of some forums in category_list
Franco 1767 Nov 3, 2002, 9:50 PM