4
votes

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
If none of the below answers suits your needs please give a more concrete example because I didn't quite get what you want. Give an example URL and the names for controller, layout and view files. From your current example I could only determine the controller file name. The others not.Ionuț G. Stan

2 Answers

4
votes

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

6
votes
$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