Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-22 10:17:31

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Article count next to each category?

Is it possible to display a count of the number of articles in each category within a category list container tag?

Offline

#2 2009-06-22 10:49:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,795
Website GitHub

Re: Article count next to each category?

FireFusion wrote:

Is it possible to display a count of the number of articles in each category within a category list container tag?

If nobody else chimes in with a better, native solution you could get the swiss army knife out:

<txp:category_list>
   <txp:category />
   <txp:smd_query
       query='SELECT COUNT(id) AS count
          FROM textpattern
          WHERE category1="<txp:category/>"
          OR category2="<txp:category/>"'>
     ({count})
   </txp:smd_query>
</txp:category_list>

Last edited by Bloke (2009-06-22 10:52:23)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2012-10-13 19:21:09

vineonardo
Member
Registered: 2011-08-31
Posts: 128
Website

Re: Article count next to each category?

@Bloke
If I was King of any kingdom, I’d have offered you a bag full of gold coins for your answer.
Your plugin and the answer you’ve given has helped me to a great degree!
Really grateful, thank you.

Offline

#4 2012-10-13 20:14:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,795
Website GitHub

Re: Article count next to each category?

vineonardo wrote:

Really grateful, thank you.

You’re welcome. The plugin has had a spruce-up recently, but it’s not officially released yet until I’ve tested it more. Keep an eye on the plugin thread for updates.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB