[pmwiki-users] Announcement: Page Variable Extensions recipe

Dominique Faure dominique.faure at gmail.com
Fri Jun 30 10:30:54 CDT 2006


On 6/30/06, Marc Cooper <gmane at auxbuss.com> wrote:
> Dominique Faure said...
> > On 6/30/06, Martin Fick <mogulguy at yahoo.com> wrote:
> > > Dominique,
> > > One feature I like is the ability to explicitly
> > > differentiate where the variables came from, GET,
> > > POST, COOKIES?  This really is reminiscent of the old
> > > days of PHP where everything shared the same namespace
> > > and then it was realized that it is often helpful to
> > > separate them.  Having separate namespaces can help
> > > prevent a user from overriding a page's intent with
> > > URLs.
> >
> > I like the way you made it as it only deals with the arguments you
> > explicitely refers to (ie this protects the further page logic from
> > hand-crafted/mis-typed reference with unwanted variables initialized).
> > But, I'm not very keen on the syntax extension you defined, since it
> > tends to pollute the page directive namespace, providing too much ways
> > to address things which have the same nature/purpose.
> > I would prefer to improve the (:set ...:) directive to handle explicit
> > initializations from url/posts/cookies parameters with something like:
> >
> > (:set v1='@(get param_name default_value)' :)
>
> Why '@' in the syntax?

To minimize interferences with regular assignation. I already used
'?(' and '?[' for conditional assignation, and it's still time to
suggest something better than '@' ;-)

> > where you may replace 'get' by 'post' or 'req'.
> > The cookie handling would need more parameters to manage domain and/or expiry.
> > In the same mood, we may also handle session datas.
>
> Sessions would be good - I already started looking at adding them ;-) I
> never use cookies - session cookie excepted.

BTW, the global expression syntax would better be:

(:set v1='@(get param_name) default_value' :)

This way, each verb is responsible of its own parameter handling,
allowing to enhance yourself the recipe with your specific
initialization sources such as sessions datas ;-)

Regards,
Dom




More information about the pmwiki-users mailing list