Pagelist with printed number of subpages for each page
I am using Concrete 5.7.3 and have a custom pagelist template which is working nicely, it correctly brings links to the pages subpages.
Part of my layout requires that I print a number a value for the number of subpages contained in each level excluding the first level.
Basically I have:
Page list start, shows: - Page 1 (2) - Subpage 1 - Subpage 2 - Page 2 (4) - Subpage 1 - Subpage 2 - Subpage 3 - Subpage 4 - Page 3 (0) - Page 4 (1) - Subpage 1 - Page 5 (0)
I was hoping someone might be able to help me get this number value to work.
I have used
Loader::model('page_list'); $pl = new PageList(); $pl->filterByParentID($cParentID); $number_of_pages = count($pl->get());
However this only shows the number of pages at the current level, not at the level under current as required to recreate the sample layout above.
Any help would be greatly appreciate.
Just to add, if possible it would be great if this could work with the Pagelist block, simply because I have this already active throughout my site.
Thank you in advance for anyone that can offer a little help.
$pageID = $page->getCollectionID(); $pl = new PageList(); $pl->filterByParentID($pageID); $number_of_pages = count($pl->get());
That will give you the number of pages under the current page in the page list loop.