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

Patrick R. Michaud pmichaud at pobox.com
Tue Jul 5 14:01:40 CDT 2005


On Mon, Jul 04, 2005 at 08:35:26PM +0200, chr at home.se wrote:
> 
> 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)

No.  There is no generalized global-variable-to-markup rule, because
doing so might expose data or settings that are better left private.
Any variables to be made available via markup have to be explicitly
done so via a markup rule of some sort.

> 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}".

Markup('{$tic-toc}', '>{$var}',
  '/\\{\\$tic-toc\\}/e',
  "array_sum(explode(' ',microtime()))");

Pm



More information about the pmwiki-users mailing list