Re: Page list templates
Simon <[email protected]> Wed, 19 Mar 2025 16:39:37 +1300
| Newsgroups | gmane.comp.web.wiki.pmwiki.user |
|---|---|
| Message-ID | <CAFUSNWNV+yBJTP462GXuGC3qO0STeX0mPsNRvHTy64qgKtAN_g@mail.gmail.com> |
👍🏽 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 <[email protected]> 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 > > > _______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users