01561: "{$$PageListCount}" is no longer available in pagelists
{$$PageListCount}" is no longer available in pagelistsDescription:
This concerns Page list template additional page variables.
The variable {$$PageListCount} is no longer returned as of PmWiki 2.6.0.
Example: (Works in WikiSandbox)
(:if false:)[@
[[#test]]
* [[{=$Group}/{=$Name}]]
(:template last:)
||class="debug simpletable"
||!Variable ||!Value ||
||PageCount || {$$PageCount}||
||EachCount || {$$EachCount}||
||GroupCount || {$$GroupCount}||
||GroupPageCount || {$$GroupPageCount}||
||PageTrailDepth || {$$PageTrailDepth}||
||''PageListCount'' || ''{$$PageListCount}''||
[[#testend]]
@]
(:ifend:)
(:pagelist fmt=#test count=5:)
| ||||||||||||||
|
I’m not sure if this is actually a bug, since it wasn’t documented anywhere in the manual. There is a brief note in Cookbook:PagelistCount stating that it was carried over to PmWiki. In my opinion, it should be included in PmWiki:PageListTemplates#additionalpagevariables.
So, in scripts/pagelist.php (PmWiki 2.7.3), the entries are counted on line 742 and stored in $opt['PageListCount'].
Starting on line 767, they are prepared for use.
On line 769, the system checks whether the content is a string; if not, it is ignored.
In PmWiki 2.5.9, the code at that point only checked whether it was NOT an array.
And here’s the catch: $opt['PageListCount'] is an integer, not a string.
Therefore, the variable cannot be accessed.
There are two ways to fix this: Either add a "strval()" on line 742, or extend the check on line 769 to include integers.
Additionally, it wouldn’t hurt to mention {$$PageListCount} in the documentation.
Thank you, this is indeed a bug that was introduced a few months ago, should work in 2.7.4 or the pre-release (see your example above), and added to the documentation as you suggested. Petko