[pmwiki-users] Problem with $FmtPV;

Ben Wilson dausha at gmail.com
Tue May 22 10:15:33 CDT 2007


Thanks. But then why does it not fail otherwise?

On 5/22/07, Stirling Westrup <sti at pooq.com> wrote:
> -----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-----
>


-- 
Ben Wilson
"Words are the only thing which will last forever" Churchill



More information about the pmwiki-users mailing list