[pmwiki-users] Problem with $FmtPV;

Stirling Westrup sti at pooq.com
Tue May 22 09:57:57 CDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben Wilson wrote:
> I am setting $FmtPV with the following value: '2007W19'; This is how I
> set it, outside of any function, but in a recipe.
> 
> $FmtPV['$YearWeek'] = '2007W19';

This won't work. The contents of $FmtPV are run through eval. That means it
has to be a valid PHP expression. 2007W19 isn't one. You need to do something
like this:

 $FmtPV['$YearWeek'] = '"2007W19"';

Because "2007W19" *is* a valid expression. If you need to use the value of a
(non-global) variable, you'd do it like this:


 $FmtPV['$YearWeek'] = '"'.$MyVariable.'"';

If $MyVariable contains a string with quotes though, things get a bit messier.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUwT05dZZEoPlyIURAl0pAJ97sphEtX6YXzyg4JWKGrstgGOy4gCeMAZW
0/MidNKzn/20AA4xzSzTo1M=
=geB3
-----END PGP SIGNATURE-----



More information about the pmwiki-users mailing list