Hello,
I am quite new to the Zend Framework so I apologize in advance if I figured/assume things wrong
I work for a SEO company and they want me to use URLs with the following format:
Quote:
|
http://www.domain.com/languagecode/controller/action
|
i.e.:
Quote:
|
http://www.domain.com/fr/register
|
has to route to controller fr and action index.
However, the normal routing still has to work (i.e.:
Quote:
|
http://www.domain.com/register
|
)
Therefore, I did the following routing in my bootstrap:
PHP Code:
$router = $frontController->getRouter(); /* @var $router Zend_Controller_Router_Rewrite */
//$router->addConfig($config->routes);
$route = new Zend_Controller_Router_Route(':lang/:controller/:action'
, array('module' => 'index',
'controller' => 'index',
'action' => 'index',
'lang' => 'en'));
$router->addRoute('lang', $route);
Now, I'd like to set a global variable which would detect the 'lang' param...
What would be the best way to do this ? I want this to be global and dont want to do the same thing in all my controllers... thats why i want to do it in bootstrap.
1) What is the best way to do this?
2) Is there any better solution you guys would have to suggest?
3) In my route, is there a way to add an optional module param ? i.e: :lang/:module/:controller/:action ... See if the module exists, otherwise, it is considered as a controller, and controller is considered like the action
THX A LOT IN ADVANCE
