[pmwiki-users] experimental - pagelist conditionals
Patrick R. Michaud
pmichaud at pobox.com
Wed May 2 09:09:15 CDT 2007
On Wed, May 02, 2007 at 10:43:58AM +0200, Roman wrote:
> > (:if date 2007-05-01..2007-05-31 {*$Name} :)
>
> I assume that each parameter accepts any expression. For example, if
> page names are in form "News-yyyy-mm-dd", the following condition
> should work. Am I right?
>
> (:if date 2007-05-01..2007-05-31 {(substr {*$Name} 5)} :)
Yes... and it's not necessary to use the {(substr ...)} .
The date converter will search any string for the first
date-looking-thing that it finds (see below). So, even
for a page named "News-yyyy-mm-dd" one can do
(:if date 2007-05-01..2007-05-31 {*$Name}:)
The date converter understands the following formats:
- A string starting with '@' and a sequence of digits is treated
as a unix timestamp
- Anything that fits one of the following patterns
yyyymmdd yyyy-mm-dd yyyy.mm.dd yyyy/mm/dd
yyyymm yyyy-mm yyyy.mm yyyy/mm
The above does more than a simple digit pattern... for example,
"yyyy" will only match dates in the range 1900 to 2039,
"mm" will require the first digit to be a 0 or 1,
"dd" only matches when the first digit is a 0, 1, 2, or 3
there can't be any other digits before or after the date
- The special strings "today", "tomorrow", and "yesterday"
- As a last resort, it calls PHP's strtotime() function to
convert to a date.
Pm
More information about the pmwiki-users
mailing list