[pmwiki-users] Any way to get page counts with breaks based on a PTV?
Petko Yotov
5ko at 5ko.fr
Wed Nov 13 12:01:03 PST 2019
I've added this for 2.2.121. There will be a new pseudovariable
{$$EachCount} similar to {$$PageGroupCount} that will contain the number
of pages in the current "each" loop.
I'm not sure if the name {$$EachCount} is good, could be
{$$CurrentLoopCount} or something else, if anyone has ideas, before we
release it.
To test this, please get the prerelease as a ZIP file from the ChangeLog
page, or from Subversion (only scripts/pagelist.php is updated for
this).
So in your template you can use {$$EachCount}:
(:template last "{=$:department}":)
{=$:department} contains {$$EachCount} pages.
See for example, Cookbook.B* pages, ordered by maintainer:
https://www.pmwiki.org/wiki/Test/EachCount
If you use (:template last "{=$:department}":) you need to also order
the pagelist by $:department, like you did.
Petko
On 11/11/2019 21:14, Christopher Cox wrote:
> Consider the following template and assume a SysUser group with pages
> of users having the PTVs: department, name and active.
>
> [[#test1]]
> (:template defaults order=$:department:)
> (:template first {=$:department}:)
>
> Users in {=$:department}
> (:template each:)
> (:if equal {=$:active} true:)
> * [[{=$FullName}|{=$:name}]]
> (:ifend:)
> (:template last {=$:department}:)
> {=$:department} contains ???? pages.
> [[#test1end]]
>
>
> My question is if there's any way to get establish a counter that is
> zeroed for each new department and can be referenced in the "last"
> where I have the ????.
>
> I know there are counters for pages and groups. Here, it's the same
> group, and I want a counter that I can set somehow based on the PTV
> change. Possible?
>
> Ultimately, I'm hoping to use such things to generate pie charts (in
> case you wondering).
>
> Department Count
> ---------- -----
> IT 3
> Accounting 5
> etc..
>
> Yes, I know I can do this with lots of individual pagelists, just
> trying to see if there was a more efficient way.
More information about the pmwiki-users
mailing list