[pmwiki-users] Announcement: Page Variable Extensions recipe

Marc Cooper gmane at auxbuss.com
Fri Jun 30 12:05:12 CDT 2006


Dominique Faure said...
> 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 '@' ;-)

Hmm It's your recipe ;-) With '@' being used in PHP, this reads odd to 
me. Yup, it's not PHP, but regular users aren't going to be using this 
syntax in any case. I can understand that you don't want to build a 
mini-parser too.

Why not use a separate markup verb?

> > > 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' :)

Sorry, better than what?

> 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 ;-)

I'm sorry, I don't follow you - it's Friday.

-- 
Best,
Marc





More information about the pmwiki-users mailing list