:controller/:action/:id do not support /key/value/ syntax.
I need support for /key/value/ param, and for some controller actions
/JUSTONEVALUE/, with one default rewrite rule. This actually what mine
patch is doing.
On Fri, Feb 29, 2008 at 7:20 PM, Eric Coleman <[EMAIL PROTECTED]> wrote:
> You don't even need a regex route really... You could define a route as:
>
> :controller/:action/:id
>
> and getParam('id') => 1 in your example.
>
> Regards,
> Eric
>
>
>
> On Feb 29, 2008, at 1:14 PM, Nicolae Namolovan wrote:
>
> > Thanks guys, but I think there is no way to change
> > Zend_Controller_Router_Route_Module behavior (what by default is the
> > default router) without patching it. What I've done, just copy/paste
> > it (Zend\Controller\Router\Route\Module.php) in mine library
> > directory, and then added after this
> >
> > " for ($i = 0; $i < $numSegs; $i = $i + 2) {
> > $key = urldecode($path[$i]);
> > $val = isset($path[$i + 1]) ? urldecode($path[$i +
> > 1]) : null;
> > $params[$key] = $val;
> > }
> > "
> >
> > This:
> >
> > " if ( ($numSegs % 2) == 1) {
> > $params[0] = urldecode($path[$numSegs - 1]);
> > }
> > "
> >
> > And to change the default router I did this
> >
> > $compat = new New_Route_Module(); //the new name of the patched class
> > $rewriteRouter = new Zend_Controller_Router_Rewrite();
> > $rewriteRouter->addRoute('default', $compat);
> > $front->setRouter($rewriteRouter);
> >
> > Now if there's a param without key, it will be accessible from a
> > controller at $this->_getParam(0).. Just what I wanted.. And still
> > have the key->param feature.. Great.
> >
> > On Fri, Feb 29, 2008 at 4:39 PM, Vincent <[EMAIL PROTECTED]> wrote:
> >> You might be interested in
> >>
> http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.regex
> >>
> >>
> >>
> >>
> >> On 29/02/2008, Nicolae Namolovan <[EMAIL PROTECTED]> wrote:
> >>> Yes, but I want to do one rewrite route for all actions.. I mean
> >>> change the default router.
> >>> For example, very often I need just one paramater, so it doesn't
> >>> make
> >>> too much sense to pass param name too..
> >>> I'd like to get one_param from /controller/action/one_param..
> >>> Any way to do that with getParam() ? And how I must rewrite the
> >>> route
> >>> to leave the /key/value behavior and just add /value behavior..
> >>>
> >>>
> >>> On Wed, Feb 27, 2008 at 5:07 PM, James Dempster <[EMAIL PROTECTED]>
> >> wrote:
> >>>> You might find that this is more what you are looking for?
> >>>>
> >>
> http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.basic
> >>>>
> >>>>
> >>>>
> >>>> On Wed, Feb 27, 2008 at 12:57 PM, Nicolae Namolovan
> >> <[EMAIL PROTECTED]>
> >>>> wrote:
> >>>>> Is it possible to do a default router with same characteristics as
> >> current
> >>>> one:
> >>>>>
> >>>>> Module + controller + action + params:
> >>>>>
> >>>>> But also with
> >>>>> Module + controller + action + 1param:
> >>>>> Example:
> >>>>> /some/list/1
> >>>>>
> >>>>> And getParam(0) should return 1.. ?
> >>>>>
> >>>>> --
> >>>>> Sincerely,
> >>>>> Nicolae Namolovan.
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> /James
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Sincerely,
> >>>
> >>> Nicolae Namolovan.
> >>>
> >>
> >>
> >>
> >> --
> >> Vincent
> >
> >
> >
> > --
> > Sincerely,
> > Nicolae Namolovan.
>
>
--
Sincerely,
Nicolae Namolovan.