[pmwiki-users] {(...)} markup recipe available
Patrick R. Michaud
pmichaud at pobox.com
Sun Apr 15 18:36:22 CDT 2007
On Sun, Apr 15, 2007 at 11:47:27PM +0100, Hans wrote:
> Sunday, April 15, 2007, 11:41:15 PM, Patrick wrote:
>
> > Still shorter:
>
> > $FmtPV['$AccessCode'] = rand(100, 999);
>
> > Or if you really feel a need to use the {(...)} markup:
>
> > $MarkupExpr['captcha'] = rand(100, 999);
>
> Both fine! Can you please explain the difference between
>
> $MarkupExpr['captcha'] = rand(100, 999);
> and
> $MarkupExpr['captcha'] = 'rand(100, 999)';
The first one causes {(captcha)} to always return the same
value every time it's used on any given request.
The second one causes {(captcha)} to return a different
value every time it's used.
The reason is that the first one calls rand(100, 999) at
the time $MarkupExpr['captcha'] is set, and uses that
value for all instances of the {(captcha)} markup.
The second one calls rand(100, 999) each time {(captcha)}
is evaluated in the markup.
Pm
More information about the pmwiki-users
mailing list