我有这个设置:
application
---admin
-----controllers
-------IndexController.php
---public
-----controllers
---modules
-----users
-------controllers
-----pages
-------controllers
我想要这条路线:
www.domain.com/admin/modulename/controller/action/
或者如果模块不存在,我使用管理控制器
www.domain.com/admin/controller/action/
有任何建议吗?
由于
答案 0 :(得分:0)
在你的bootstrap文件中写下这段代码:
$router = Zend_Controller_Front::getInstance()->getRouter();
if($moduleName){
$route = new Zend_Controller_Router_Route(
':module/:controller/:action/',
array(
'controller' => $ControllerName,
'module' => '$moduleName',
'action' => $ActionName
)
);
}else{
$route = new Zend_Controller_Router_Route(
':controller/:action/',
array(
'controller' => $ControllerName,
'action' => $ActionName
)
);
}
$router->addRoute('default', $route);