optional zend route
I have a Zend app using a custom route:
$router->addRoute(
'search',
new Zend_Controller_Router_Route('sea开发者_StackOverflow中文版rch/:s/*',array(
'module' => 'public',
'controller' => 'post',
'action' => 'search'
));
$router2->addRoute(
'search',
new Zend_Controller_Router_Route('search/:s/type/:controller/*',array(
'module' => 'public',
'controller' => 'post',
'action' => 'search'
));
But i wanna know if it's possible to make "type/:controller" optional (and a default value for controller asignated) and unificate these two rules in one so that It works for:
mydomain/search/prueba
=> controller is post and action is search
mydomain/search/prueba/type/event
=> controller is event and action is search
精彩评论