[pmwiki-users] Using variable in skin template

Hans design5 at softflow.co.uk
Sat Oct 24 02:56:55 CDT 2009


Friday, October 23, 2009, 11:56:25 PM, DaveG wrote:

>> Parse error: syntax error, unexpected T_STRING in
>> /<path>/pmwiki.php(762) : eval()'d code on line 1
> That's because the PageVar needed to be quoted, as Hans showed. Thus,
>     $FmtPV['$myvar'] = 'PageVar($pagename,\'$:myvar\')'

There were in fact several things wrong with your code:

1. missing quotes
2. wrong function: PageTextVar() is used to exctract a PTV
3. use of $pagename: use $pn rather than $pagename as $ pagename may
   have a different value.
4. PTV name: if the PTV is named in the page 'myvar', then
   that should be used a parameter in the PageTextVar() call.
   PageVar($pn, "myvar")
   {$:myvar} is the syntax to refer to th ePTV in a wiki page.


  ~Hans




More information about the pmwiki-users mailing list