[pmwiki-users] Page text variable arithmetic

Steve Glover steve at fell-services.net
Thu Aug 30 08:00:55 CDT 2007


On Wed, 2007-08-29 at 14:16 -0500, Patrick R. Michaud wrote:
> On Wed, Aug 29, 2007 at 04:07:01PM -0300, Guillermo Calderon - INCO wrote:
> > Steve Glover wrote:
> > > Hi,
> > > 
> > > Is there a way, please, of carrying out either arithmetic or comparisons
> > > when creating a PTV?
> > > 
> > > I have {(ftime fmt="%Y%m%d" when="{$Title}")} which gets the date string
> > > from my page name as yyyymmdd and {(ftime fmt="%Y%m%d" when="{$Today}")}
> > > which gets today's date in the same format, and I'd like to be able to
> > > create a variable that will indicate if page dates are past, present or
> > > future.
> > > 
> > 
> > Maybe you can achieve thiat with conditional markup:  (:if date .... :)
> > Take a look at
> > 
> >        http://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup
> 
> 
> Perhaps:
> 
>     (:if date today        "{$Title}"  :)  title is today
>     (:if date tomorrow..   "{$Title}"  :)  title is after today
>     (:if date ..yesterday  "{$Title}"  :)  title is before today

Ah! I didn't realise I could use those to control setting of a page text
variable. So in general I can have templates that have:

(:if false:)
(:if date tomorrow.. "{$Title}" :)
When: future

Many thanks!

Steve


-- 
Steve Glover at                          email: steve at fell-services.net
SDSS, EDINA, University of Edinburgh,          tel: +44 (0)131-650 2908
Causewayside House, 160 Causewayside,          fax: +44 (0)131-650 3308
Edinburgh EH9 1PR                          mobile: +44 (0) 7961 446 902




More information about the pmwiki-users mailing list