[pmwiki-users] How to retrieve the value of a Page Text Variable {Group/PageName$:Var} from a cookbook ?

marc gmane at auxbuss.com
Fri Nov 24 05:11:25 CST 2006


Christophe David said...
> 
> Is there an easy way to retrieve the value of a Page Text Variable
> {Group/PageName$:Var} from a cookbook, or must the cookbook parse 
> the whole page to extract the variable content ?

I'm not sure what you mean exactly.

  {Group/PageName$:Var}

is markup to retrieve a page variable, as you say. So, one page 
references another, and the markup only makes sense when the page 
containing the markup is displayed - when, as you say, it PmWiki parses 
the referenced page for the page variable.

Now, taking a guess, since you mention retrieving variables from a 
cookbook, then you might mean doing something like:

  $FmtPV['$PageCreationDate'] = 'strftime("m-%d", $page["ctime"])';

in your recipe script, and the following markup

  This page was created on: {$PageCreationDate}


>From the PmWiki docs:

  $FmtPV
   This variable is an array that is used for Page Variables. New
   variables can be defined with

     $FmtPV['$VarName'] = 'variable definition';

   which can be used in markup with {$VarName}. 


Hope that helps.

-- 
Best,
Marc





More information about the pmwiki-users mailing list