[pmwiki-users] Using Page Text Variables in a pagelist
Petko Yotov
5ko at 5ko.fr
Sun Jul 17 03:39:59 CDT 2016
A misunderstanding about PageTextVariables comes up often.
The reality is that the value is always the text that is written in the
page. It is only evaluated when the variable is printed/output to HTML.
So when you want to sort by that variable, all values in all pages are
the not-yet-evaluated text strings, and the order function does what it
can with them. It does not process/evaluate the text at this point.
With your page names, it will be simpler to use a PageVariable, not a
PageTextVariable:
$FmtPV['$NameToYearMonth'] = 'strftime("%Y%m", strtotime($name))';
Then use (:pagelist order=$NameToYearMonth:)
If this is not possible, writing in the wiki page:
(:MonthNum:07:)
might be easier for some than:
(:MonthNum:{(ftime fmt=%m when="{$Namespaced}")}:)
and this would work for ordering.
Petko
---
Change log : http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes : http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade : http://www.pmwiki.org/wiki/PmWiki/Upgrades
On 2016-07-17 09:31, Simon wrote:
> In a page[1
> <http://ttc.org.nz/pmwiki/pmwiki.php/FixtureCard/2016April>] I
> declare the page text variables
>
> (:Year:{(substr {$Name} 0 4)}:)
> (:MonthNum:{(ftime fmt=%m when="{$Namespaced}")}:)
>
> Note the page name is in the format yyyymonth. e.g "2016 April"
>
>
> I create a pagelist[2
> <http://ttc.org.nz/pmwiki/pmwiki.php/FixtureCard/GroupHeader>][3
> <http://ttc.org.nz/pmwiki/pmwiki.php/Site/LocalTemplates>] with an
> order
> based on the page text variables
> (:pagelist group=FixtureCard name=2*,-*Half*,-*ClubNight*
> fmt=#grouptrail
> order=$:Year,$:MonthNum :)
>
> I'm not getting the order I expect from the pagelist.
>
> If anyone can suggest where I could look to get this to work I'd
> appreciate
> it
More information about the pmwiki-users
mailing list