[pmwiki-users] experimental - pagelist conditionals

Jiri Hladůvka / OBUTEX admin at obutex.com
Wed May 2 03:47:51 CDT 2007


Patrick R. Michaud napsal(a):
> I'm experimenting with a couple of new features, and looking
> for feedback.
>
> 1.  Extension to (:if date ... :)
>
> Currently the 'date' conditional can only be used to test
> that the current time is in a range of dates.  For example,
> to display some text only if the current date is between
> March 15 and May 2 inclusive, one can write:
>
>     (:if date 2007-03-15..2007-05-02 :)
>
> I've added an extra parameter to the 'date' conditional,
> so that times other than the current time can be tested.
> For example, to check if the current page's name is
> in the month of May 2007, one can write:
>
>     (:if date 2007-05-01..2007-05-31 {*$Name} :)
>
> Thus, this would evaluate to true for pages with names
> like "20070512" or "2007-05-31", but false for pages
> with names like "2007-04-30" or "2008-05-15".
>
> Also, date ranges now understand phrases like "today",
> "tomorrow", "now", etc.
>
>   
Will this work with PTV e.g.
 (:if date 2007-05-01..2007-05-31 {*$:MyDate} :)
(:pagelist group=MyGroup $:MyDate=?* if="date 2006-01..2006-12 
{$:MyDate}" :)


Regards,
Jiri
> 2.  if= option to (:pagelist:)
>
> I'm also looking at the possibility of adding a new 
> if= option to pagelist.  The contents of any if= option 
> are treated as a conditional markup (same as the "(:if:)" 
> directive) to be evaluated; only pages that evaluate
> to "true" are kept in the pagelist.  Thus, combined with
> the above, one can write:
>
>     (:pagelist if="date today.. {=$Name}" :)
>
> This returns a list of all pages with names that
> correspond to dates today or later.  Some other
> examples that become possible with this:
>
> - Display all pages with names in the current month
>     (:pagelist if="date {(ftime %Y-%m)} {=$Name}" :)
>
> - Display all pages in PITS that were created in 2006
>     (:pagelist group=PITS $:Created=?* if="date 2006-01..2006-12 {$:Created}" :)
>
> - Display only pages for which the visitor has edit permission
>     (:pagelist if="auth edit {=$FullName}" :)
>
> Of course, using if= in (:pagelist:) will be somewhat
> more efficient than (:if:) conditionals in a pagelist
> template, and it also makes it easier to add count=
> and other conditions on the resulting list.
>
> Examples also appear at
>
>    http://www.pmwiki.com/wiki/Test/PageListIf
>
> Comments welcomed.
>
> Pm
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
> __________ Informace od NOD32 2232 (20070430) __________
>
> Tato zprava byla proverena antivirovym systemem NOD32.
> http://www.nod32.cz
>
>
>
>   

-- 
OBUTEX s.r.o
Ing.Jiří Hladůvka
Zlatovská 22
911 01 Trenčín

tel.: +421 (0)32 6587000
mailto:admin at obutex.com

http://www.obutex.com





More information about the pmwiki-users mailing list