x
 
Create New Page
 View Previous Changes    ( Last updated by Tux Kapono )

Forum Post Count with Weblog Entry

Question:

How do I show how many forum posts there are in for an entry linked to that forum post?

Answer:

{if forum_topic}

<a href="{path=forums/viewthread}{forum_topic_id}">Discuss

{exp
:query sql="SELECT thread_total FROM exp_forum_topics WHERE topic_id = '{forum_topic_id}' "}

({thread_total})</a>

{/exp:query}

{
/if}

The only catch is that this counts the first post, not just the replies. Otherwise use the following:

{if forum_topic}

<a href="{path=forums/viewthread}{forum_topic_id}">Discuss
{exp
:query sql="SELECT (thread_total)-1 AS my_total FROM exp_forum_topics
WHERE topic_id = '{forum_topic_id}' "
} ({my_total})</a> {/exp:query}

{
/if}

Thanks to Connie du Toit in this thread

Category:Templates Category:Entries Category:Forums

Categories: