如何在自定义模块(在我的情况下为admin模块)中为Zend Framework设置默认语言的路由。
我有以下代码:
$langRoute = new Zend_Controller_Router_Route(
':lang/admin',
array(
'lang' => 'ro',
)
);
我想要获得的是url,如下所示:
www.example.com/ro/admin/pages/add/62
www.example.com/ro/admin/pages/index/by/date_modified/order/asc
等
答案 0 :(得分:0)
尝试此操作:
protected function _initRoutes() {
$langRoute = Zend_Controller_Front::getInstance ()->getRouter ();
$langRoute->removeDefaultRoutes ();
$route = new Zend_Controller_Router_Route(
':lang/:module/:controller/:action/*',
array (
'lang' => 'ro',
'module' => 'admin',
'controller' => 'index',
'action' => 'index'
)
);
$langRoute->addRoute ( 'langrouter', $route );
}