the problem is that this routing rule is only a simplified example of my
routing rules, which are more complex. If i don't find a solution it means a
lot of routing rules (very slow) :S
Thanks.
On 8/31/07, David Brewer <[EMAIL PROTECTED]> wrote:
>
>
> Oh, I see. I don't know if the routing rules work that way or not, I
> always thought that anything you defined specifically under param
> would override anything that came from the url.
>
> When I've wanted to do things like this in the pass, I would use two
> or more different rules:
>
> url: /:mode
> param: { module: categories, action: show, category1: 1 }
> requirements: { mode: ^(basic|premium) }
>
> url: /:mode/:category1
> param: { module: categories, action: show }
> requirements: { mode: ^(basic|premium), category1: \d+ }
>
>
> On 8/31/07, Yeray Rodriguez <[EMAIL PROTECTED]> wrote:
> > Hi David,
> >
> > thanks for your answer. I defined category1 under param to give it a
> default
> > value to avoid another routing rule when there isn't category1 on the
> url.
> >
> >
> > On 8/31/07, David Brewer <[EMAIL PROTECTED]> wrote:
> > >
> > > Try this variation on your routing rule:
> > >
> > > url: /:mode/:category1
> > > param: { module: categories, action: show }
> > > requirements: { mode: ^(basic|premium), category1: \d+ }
> > >
> > > You don't need to define settings for the category1 or mode parameters
> > > under 'param' as since they are part of the URL, they will
> > > automatically get set.
> > >
> > > David Brewer
> > >
> > > On 8/31/07, Yeray Rodriguez <[EMAIL PROTECTED] > wrote:
> > > >
> > > > Hi, I'm using Symfony 1.0.6 and i have a problem con routing
> > > >
> > > > if i define this rule:
> > > >
> > > > example:
> > > > url: /:mode/:category1
> > > > param: { module: categories, action: show, mode: basic, category1:
> > > > 1 }
> > > > requirements: { mode: ^(basic|premium), category1: \d+ }
> > > >
> > > > with this url: /premium/2
> > > >
> > > > i get next:
> > > >
> > > > $this->getRequestParameter("mode") -> premium
> > > > $this->getRequestParameter("category1") -> premium
> > (incorrect)
> > > >
> > > > Debugging sfRouting (parse method) i've found that :
> > > >
> > > > if (preg_match($regexp, $url, $r)) ....
> > > >
> > > > $regexp = #^(?:\/((basic|premium)))?(?:\/(\d+))?$#
> > > > $url = /premium/2/
> > > > $r=Array ( [0] => /premium/2 [1] => ofertas [2] => ofertas [3] => 2
> )
> > > >
> > > > maybe regexp is not well defined?? any idea? Thanks.
> > > >
> > > >
> > > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > "La imaginación puede llevarte a cualquier lado"
> >
> > >
> >
>
> >
>
--
"La imaginación puede llevarte a cualquier lado"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---