[pmwiki-users] Page list templates
Simon
nzskiwi at gmail.com
Tue Mar 18 20:39:37 PDT 2025
👍🏽
Simon reacted via Gmail
<https://www.google.com/gmail/about/?utm_source=gmail-in-product&utm_medium=et&utm_campaign=emojireactionemail#app>
On Tue, 18 Mar 2025 at 21:27, Petko Yotov <5ko at 5ko.fr> wrote:
> 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
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/vnd.google.email-reaction+json
Size: 41 bytes
Desc: not available
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20250319/d44f3f30/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20250319/d44f3f30/attachment.html>
More information about the pmwiki-users
mailing list