Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
I want to show the total number of articles in a number format.

So lets say i have 255 cloned pages within a section called articles and then want to show this on lets say a menu bar of like.

Articles
255

can i get this to work?
Hi Simon,

cma:pages tag when used with the 'count_only' parameter returns just the count of the pages which would have been otherwise fetched e.g.
Code: Select all
<cms:pages masterpage='articles.php' count_only='1' />

You can save the count in a global variable and use that variable at any other location in the template e.g.
Code: Select all
<cms:set my_pages_count="<cms:pages masterpage='articles.php' count_only='1' />" global='1' />
..
..
<cms:show my_pages_count />

Hope this helps.
I wonder why the count_only parameter is not mentioned in the documentation, neither among tags nor among the pages parameters.
It's a very useful feature which I actually use a lot instead of javascript to change styles depending on the number of pages (e.g. in a css grid, image galleries and other layout matters). If we add this to the docs it would help more people?
3 posts Page 1 of 1