Count Number Of Sub Pages Of Current Page

The macro <<PageCount(exists)>> returns the count of all pages in the wiki. Would it be possible to have a modified version of this macro that returns the count of only the subpages of the page from which the macro is called?

For example:

Page = NorthAmerica
SubPage = NorthAmerica/Canada
SubPage = NorthAmerica/USA
SubPage = NorthAmerica/Mexico

Result of the requested macro, when called from page NorthAmerica would be 3 .

Discussion

You can use the macro <<Hits>> on the page. e.g. We have <<Hits(event_type=VIEWPAGE)>> hits on this page.

I tried using <<Hits(event_type=VIEWPAGE)>>. It returns a much larger number than 3. When I use <<Hits(event_type=SAVEPAGE)>>, the returned number is smaller, but still larger than 3. Also, the returned number increases (though not every time) after saving the page or the sub page. Thank you (11/24/2010)

Oh, sorry I got it wrong, you are not interested in counts rather on amount of subpages.

In principle yes but getPageCount would need an API change. 1.9 is not in development process. So we likly avoid changing API. Alternativly it could be done by a macro calling getPageList with a filter. If PageCount macro becomes converted to moin-2.0 one could implement it.

My programming skills are rudimentary at best. Could you point me to an example of a macro that uses getPageList so that I can try to adapt it? Thanks.

CategoryFeatureRequest

MoinMoin: FeatureRequests/SubPageCount (last edited 2018-08-18 13:24:54 by ThomasWaldmann)