Hi Antonio,
El mié, 10-03-2010 a las 20:33 +0100, [email protected] escribió:
> Hi,
> i need a way to get the route name and the params from an Url of the  
> application.
> 
> For example, if i have the following route...
> 
>   $page = new Zend_Controller_Router_Route(
>       '/:ident',
>       array(
>         'module'       => 'core',
>         'controller' => 'pagine',
>         'action'      => 'view',
>         'language' => 'it'
>       ),
>       array(
>         'ident' => '[a-zA-Z-_0-9]{3,}'
>       )
>   );
>   $router->addRoute('pagina', $page);
> 
> ...and i have the URL "/contatti" then i would know that the matched  
> route is "pagina" and the parameters are ident=contatti and language=it
> 
> Is possible ask this directly to the router?

To get the route from the controller you can use:
    $bootstrap = $this->getInvokeArg('bootstrap');
    $route = $bootstrap->getResource('router')->getCurrentRouteName();

To get the language param, just as usual:
    $this->getRequest()->getParam('language');


-- 
Alayn Gortazar
Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
+34 94.404.81.82


Reply via email to