Zend framework (1.7.5): how to change controller d

2019-02-24 08:43发布

Using Zend Framework I want to use controllers stored in a directory which is not default.

What I'm trying to achieve is that if the requested path begins with admin/ controllers/admin is used, with layout/admin and views/admin etc.

How would I go about achieving this in a reasonably graceful manner?

2条回答
劳资没心,怎么记你
2楼-- · 2019-02-24 09:21
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(...path...);

OR multiple paths

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array(
    'default' => '/path/to/application/controllers',
    'blog'    => '/path/to/application/blog/controllers'
));

http://framework.zend.com/manual/en/zend.controller.front.html

查看更多
乱世女痞
3楼-- · 2019-02-24 09:41

You could use the module directory structure. Create the directory structure

application
  default
    controllers
    views
    models
  admin
    controllers
    views
    models

For more info check out the docs on Using a Conventional Modular Directory Structure

查看更多
登录 后发表回答