[pmwiki-users] Page list templates
Petko Yotov
5ko at 5ko.fr
Tue Mar 18 01:27:30 PDT 2025
You could add a custom page variable holding the first 4 letters of
$Name:
In local configuration:
$FmtPV['$Name04'] = 'substr($name, 0, 4)';
And use that in a template:
(:template first "{=$Name04}":)
'''{=$Name04}:'''
This may work best if the pagelist is ordered by name.
Petko
On 18/03/2025 09:08, Simon wrote:
> Page list templates are a powerful and useful mechanism in PmWiki.
>
> I've got a use case where I have many page names prefixed by date -
> i.e. "yyyy-mm-dd etc"
>
> I would like to group then into years, e.g. by something like this
>
> (:template first {(substr {=$Name} 0 4)}:)
>
> any suggestions on how I can achieve this.
> As you may surmise the above does not work
>
> thanks
>
> Simon
>
> PS note interestingly I can do this
>
> (:template defaults year='{(substr {=$Name} 0 4)}':)
> and use {$$year} successfully in the page list template
>
More information about the pmwiki-users
mailing list