[pmwiki-users] Pagelist {$$option} does not accept page variable value?
Patrick R. Michaud
pmichaud at pobox.com
Thu Mar 22 18:04:44 CDT 2007
On Thu, Mar 22, 2007 at 11:01:41PM +0100, Roman wrote:
> I'll demonstrate my problem on my parcticular case which, I think,
> could be useful for others.
>
> I have a group of pages, each page has a page text variable (PTV)
> called Date which holds a value of date in ISO format. (Just for
> explanation, I can't use neither page creation date nor page
> modification date for this purpose.)
>
> I want to create a pagelist of pages with value of PTV Date within
> last seven days. So I created these two page variables
>
> $FmtPV['$TodayISO'] = 'date("Y-m-d")';
> $FmtPV['$SevenDaysAgoISO'] = 'date("Y-m-d",
> mktime(0,0,0,date("m"),date("d")-7,date("Y")))';
>
> Because pagelist directive does not support ranges of PTVs (like
> $:Date={$SevenDaysAgoISO}..{$$TodayISO}) I defined pagelist template
> with the help of ConditionalExtensions recipe this way:
>
> [[#Last7Days]]
> (:if [ ( gt {{=$FullName}$:Date} {$$startdate} ) && ( le
> {{=$FullName}$:Date} {$$enddate} ) ] :)
> (:include {=$FullName} self=0:)
> (:ifend:)
> [[#Last7DaysEnd]]
>
> It works when I use literal date values, for example
> (:pagelist group=MyGroup fmt=#Last7Days startdate=2007-03-15
> enddate=2007-03-22:)
>
> but does not work when I use page variables values
> (:pagelist group=MyGroup fmt=#Last7Days startdate={$TodayISO}
> enddate={$SevenDaysAgoISO}:)
Try displaying just {$TodayISO} and {$SevenDaysAgoISO} before
the (:pagelist:) directive, just to make sure they're correct.
Also, inside of the pagelist template, display {$$startdate}
and {$$enddate} as part of the output (not just in the (:if:)
statement), so we can see what values are appearing there.
> It looks like pagelist {$$option} does not accept page variable value.
No, that's supposed to work, so it's either a bug in PmWiki
or something else must be going wrong here.
Thanks!
Pm
More information about the pmwiki-users
mailing list