[pmwiki-users] Re: Re: Some documentation added for "markup variables" (Was: How to add a variable to {$var}-markup?)

chr at home.se chr at home.se
Mon Jul 4 13:35:26 CDT 2005


On Mon, 4 Jul 2005, Patrick R. Michaud wrote:

> On Mon, Jul 04, 2005 at 09:16:02AM +0200, chr at home.se wrote:
> > On Fri, 1 Jul 2005, Patrick R. Michaud wrote:
> > > On Tue, Jun 28, 2005 at 10:38:21AM +0200, chr at home.se wrote:
> > > > I've added an example of how you can define your own variable -
> > > > it'd be good if someone can comment on that bit. For instance, how do you
> > > > get the variable to be "dynamically expanded"? I assume this is involves
> > > > doing something like:
> > > > 
> > > > 	$GLOBALS['var'] = '...<magic code invoking ...Fmt()...>';
> > > 
> > > Depends on what you mean by "dynamically expanded"  -- do you mean
> > > dynamically expanded by markup or by FmtPageName?
> > 
> > I mean using FmtPageName(). So what I'd like is an example of how to
> > define the value of a "${variable}" using FmtPageName(). 
> 
> If you mean, how do you define a variable that can be used by FmtPageName
> (when it is formatting a string), there are several ways to do it:

While interesting, it wasn't quite what I was looking for as you
suspected... so let me give two (created) examples to be crystal clear :-)

Example 1: For unknown reasons, we want '{$PageNameInLowerCase}' to always
return the name of the current page using only lower case letters. Would
this be possible to do using $GLOBALS['var'] = ...?
(I suspect this quite trivial, I just want a simple illustrating example
to put on the page where this is documented)

Example 2: For unkown reasons, we want '{$tic-toc}' to return the current
time in system ticks (or milliseconds or whatever). In order to get this,
some function would have to be invoked for each instance of '{$tic-toc}'
that is to be replaced. Note that the funtion must be invoked once for
each occurence of "{$tic-toc}".

(I suspect this is non-trivial, and Markup() that we really should be
defining a separate markup for something like this. And in that case, 
I'd like to write something like this in the documentation - ideally 
with an example of how to do it using Markup(). ).

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list