Am 08.07.2010 19:25, schrieb Laurent Melmoux:
> Hi,
>
> I'm trying to add "language route" support. I'm using the code down below :
>
> $router = new Zend_Controller_Router_Rewrite();
> $languageRoute = new Zend_Controller_Router_Route(':language',
> array('language' => 'fr'), array('language' => 'fr|en'));
> $defaultRoute = new
> Zend_Controller_Router_Route(':module/:controller/:action/*',
> array( 'module' => 'default',
> 'controller' => 'index',
> 'action' => 'index')
> );
> $router->addRoute('default', $languageRoute->chain($defaultRoute));
That's fine so far, nothing wrong with that.
> But if there is no params or only the language code in the url, routing
> doesn't work !
>
> on routeShutdown I have
>
> / => All Request object param's are set to null
> /fr => All Request object param's are set to null
>
> But with a module name every thing works ok.
> /fr/a-module-name => fr/a-module-name/index/index
>
> Does any body have some advice to give me to sort this out ?
This is actually a bug, or more, a shortcoming, in the current system,
which is hardly solvable. It will be solved with the new routing system
in ZF2 tho. For the moment I'd suggest you the following to work around it:
Have one empty static route, which sets default language, module,
controller and action. Have an additional single language route which
sets default module, controller and action. After those, have you
chained route.
Hope that helps.
--
Ben Scholzen 'DASPRiD'
Community Review-Team | [email protected]
Zend Framework | http://www.dasprids.de
PGP key: http://stuff.dasprids.de/pgp/ben-scholzen-pgp-key.asc