View Single Post
  #1 (permalink)  
Old 02-15-2008, 08:44 AM
danield danield is offline
Junior Member
 
Join Date: Aug 2007
Posts: 6
Default how to work with controllers in subdirectories

Hello,

I'm a beginner with zf, and I'm trying now to create some controllers in different directorys.

I created an IndexController into the directory /application/backend/controllers/cars. But I don't know how to reach the controller.

I know that it will work fine, if I will create an CarController.php into the directory /application/backend/controllers.

But because I want to create many Controllers, I would like to seperate them in different directorys.

Is there a good way to organize the controllers, and how can I do this?
And how can I call the controllers in subdirectorys?

/application/backend/controllers
AuthController.php
ErrorController.php
IndexController.php

/application/backend/controllers/cars
IndexController.php

/application/backend/index.php
PHP Code:
set_include_path('.' PATH_SEPARATOR '../../library' PATH_SEPARATOR '../../application/backend/models/' PATH_SEPARATOR get_include_path());
require_once 
'Zend/Controller/Front.php';
.
.
.
/**
 * Setup controller
 */
$frontController Zend_Controller_Front::getInstance();
$controller Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('../../application/backend/controllers');
$controller->throwExceptions(true); // should be turned on in development time 
Thanks for help!
Reply With Quote