Is there a way to get the count of pages for each topic in the Topic List Block

Permalink
Hi,

Im building a website for a client, and the client wants a count of pages that contains a given topic. - Like WP does out of the box. I have made a function that count pages beneath a specific page - Fairly easy. but i cant find any examples where there is a count in a topic list.

I am working in a direction where I will use the following code for each keyword and then filter the count with each keyword - That my Idea anyway. But im afraid it will be slow.

$c = Page::getCurrentPage();
$numChildren = $c->getNumChildren();
if ($numChildren ==0) {
   $c = Page::getByID(159);
   $numChildren = $c->getNumChildren();
   }


Is this the right path im following, or is there an easier way?

Kind regards
Kresten Buch

Kresten
 
siton replied on at Permalink Reply
siton
Try this - in the past i ask Q almost the SAME :)
https://www.concrete5.org/community/forums/usage/add-to-the-topic-li...

Tuturial :: How to Display Number of Child Pages (by PineCreativeLabs)
http://documentation.concrete5.org/tutorials/how-display-number-chi...
Kresten replied on at Permalink Best Answer Reply
Kresten
Thank you for your response. I did not find the link your posted - I need better google skills :0)

EDIT: The link is not what i wanted - It counts pages under a page, and that is not what i was looking for. I need a function that counts how many pages has been tagged by a topic...
siton replied on at Permalink Reply
siton
mmm Yes you write. Maybe add this to github - i never use this but this it could be really helpful (In my opinion its even good as "build in" option inside the topic tree (Checkbox - on/off counter).

Tell me if you add a issue i will make +1