Hello,
In my CMS users may, for a specific page, optionally specify a custom URL.
The problem is that I may have pages like:
example.com/en/hello-world (a custom URL has been set: will need to match
the route "pageWithLocale", ':lang/:page/*')
and
example.com/en/services/list (will need to match the route
"default1WithLocale", ':lang/:controller/:action/*')
but I can't make it to work.
For the request "example.com/en/hello-world", ZF will match
"default1WithLocale" and say that the controller "hello-world" doesn't
exist.
I thought actually that if a route couldn't look up for the right
module/controller/action, it would try the next one, but I was wrong.
So I have no idea on how to achieve this. Below you can find my route
definitions from the bootstrap.
************************************************************************
$route = new Zend_Controller_Router_Route(':page/*');
$router->addRoute('page', $route);
$route = new Zend_Controller_Router_Route(':lang/:page/*', array(),
array('lang' => 'fr|nl|en'));
$router->addRoute('pageWithLocale', $route);
$route = new Zend_Controller_Router_Route(
':lang/:module/:controller/:action/*',
array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
),
array('lang' => 'fr|nl|en')
);
$router->addRoute('default2WithLocale', $route);
$route = new Zend_Controller_Router_Route(
':lang/:controller/:action/*',
array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
),
array('lang' => 'fr|nl|en')
);
$router->addRoute('default1WithLocale', $route);
************************************************************************
Examples of possible URLs :
example.com/en/members/profile/edit
(locale=en ; module=members ; controller=profile ; action=edit)
example.com/members/profile/edit
(locale=default locale=fr ; module=members ; controller=profile ;
action=edit)
example.com/en/services/list
(locale=en ; module=default module=default ; controller=services ;
action=list)
example.com/services/list
(locale=default locale=fr ; module=default module=default ;
controller=services ; action=list)
example.com/bonjour-le-monde
(locale=default locale=fr ; page=bonjour-le-monde)
example.com/en/hello-world
(locale=en ; page=hello-world)
Thank you for any help !!
--
View this message in context:
http://www.nabble.com/Route-question-tp24891726p24891726.html
Sent from the Zend Framework mailing list archive at Nabble.com.