Pagelist with printed number of subpages for each page

Hi all,

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
$pl = new PageList();
$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.

View Replies: View Best Answer
hutman replied on at Permalink Best Answer Reply
The code that you have is what you will need, but you need to change it just a touch, so you'll need to put it inside of the foreach and then it will need to be

$pageID = $page->getCollectionID();
$pl = new PageList();
$number_of_pages = count($pl->get());

That will give you the number of pages under the current page in the page list loop.
mobius2000 replied on at Permalink Reply
Thank you very much... Easy fix!