Thanks for the info. I thought the curly braces where a subset of regex syntax. 
The basic stuf I understood already?

I think you explanation enables me to try something else I had been wondering 
about.

Koen 

> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens David Zülke
> Verzonden: woensdag 24 januari 2007 13:48
> Aan: Agavi Users Mailing List
> Onderwerp: Re: [Agavi-Users] Generating a RSS feed
> 
> That's true, however, routes aren't full regular expressions, 
> two restrictions apply:
> - regular expressions in route patterns must be enclosed in 
> parentheses
> - non-matching pre and postfixes must be outside of the curly 
> braces that wrap the actual pattern
> 
> I believe <route pattern="^/products/view/(id:\d+)$" /> is 
> relatively straightforward even for someone with only basic 
> knowledge of regular expressions. all you have to know is 
> that they may only occur in parantheses, and that the name of 
> the parameter that should contain the match is at the 
> beginning, followed by a colon.
> 
> (foo{id:\d+}bar) is a special syntax by agavi, the curly 
> braces are used as delimiters for pre and postfix. for 
> "foo23bar", this example puts only "23" into the parameter 
> "id". that's why you hae to set the defaults with curly 
> braces, because the pre and postfix could also be a regular 
> expression, and agavi must know a constant value to use when 
> generating urls (since you cannot set the pre and postfix 
> from gen(), only the "inner" value).
> 
> 
> David
> 
> 
> Am 24.01.2007 um 13:31 schrieb Van Daele, Koen:
> 
> > Thanks,
> >
> > Now it does what I want it to do. :)
> >
> > Seems I'll have to look into regex's a bit deeper. Might be able do 
> > some nice things with it. I do think it'll be difficult to 
> explain the 
> > power of routing to users who don't have a good grasp of regexes.
> >
> > Koen
> >
> >> -----Oorspronkelijk bericht-----
> >> Van: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] Namens David Zülke
> >> Verzonden: woensdag 24 januari 2007 13:20
> >> Aan: Agavi Users Mailing List
> >> Onderwerp: Re: [Agavi-Users] Generating a RSS feed
> >>
> >> use
> >>
> >> <default for="id">/{1}</default>
> >>
> >> together with that.
> >>
> >>
> >> Am 24.01.2007 um 13:18 schrieb Veikko Mäkinen:
> >>
> >>> Van Daele, Koen wrote:
> >>>> This works, but it leads to url's like: /nieuws//rss
> >>>>
> >>>> Still not as elegant as I'd like. Is there a way to make
> >> one of those
> >>>> slashes disappear if the parameter is not set?
> >>>
> >>> There is :)
> >>>
> >>> Here's an example:
> >>>
> >>> name="foo" pattern="foo(/{id:\d+})?/bar"
> >>>
> >>> gen('foo', array('id'=>null)) -> '/foo/bar'
> >>>
> >>> gen('foo', array('id'=>2)) -> '/foo/2/bar'
> >>>
> >>>
> >>> -veikko
> >>>
> >>>
> >>> _______________________________________________
> >>> users mailing list
> >>> [email protected]
> >>> http://lists.agavi.org/mailman/listinfo/users
> >>>
> >>
> >>
> >> _______________________________________________
> >> users mailing list
> >> [email protected]
> >> http://lists.agavi.org/mailman/listinfo/users
> >>
> >
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.agavi.org/mailman/listinfo/users
> >
> 
> 
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
> 

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to