[pmwiki-devel] Creating a page text variable in a recipe

DaveG pmwiki at solidgone.com
Sat Sep 26 09:59:16 CDT 2009



On 9/26/2009 4:24 AM, Simon wrote:
> I have set up some page variables
>    $FmtPV['$ChordProVersion'] = $RecipeInfo['ChordPro']['Version'];
>    $FmtPV['$SongTitle'] = $title;

Whatever you assign to FmtPV needs to be valid php. If $title doesn't 
change throughout the code then:
   $FmtPV['$SongTitle'] = "'".$title"'";

If it does:
   $FmtPV['$SongTitle'] = '$GLOBALS["title"]';


Refer to PmWiki/OtherVariables#FmtPV for more info.


  ~ ~ David

> I did this in the function (Chord_Parse) that is called by the Markup
> function.
> The variables don't show up on the page, do I need to make something global?
> Or perhaps I need to do something else in addition (eg edit page?)
>
> thanks
>
> Simon
>
> 2009/9/24 Petko Yotov <5ko at 5ko.fr <mailto:5ko at 5ko.fr>>
>
>     On Wednesday 23 September 2009 12:32:25 Simon wrote:
>      > I have a recipe (ChordPro) from which I wish to create and return
>     a page
>      > text variable (eg $:SongTitle}(ie that page would have the PTV
>     usable from
>      > conditional markup, pagelists etc)
>
>     You can create a "page variable" {$SongTitle} (not page "text"
>     variable), and
>     also use it in conditionals and in pagelists.
>
>      > Can anyone point me at an exemplar of how this is done.
>
>     There are a couple of examples here :
>     http://www.pmwiki.org/wiki/Cookbook/MoreCustomPageVariables
>
>     Petko
>
>
>
>
> --
> ____
> http://kiwiwiki.co.nz
>
>
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel



More information about the pmwiki-devel mailing list