|
|||
|
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:
|
|
|||
|
Quote:
If you have a module other than the default one and want to set the path to its controller, you can call: PHP Code:
Do NOT prefix the filename of the Cars_IndexController, it should be called IndexController.php! An easy way to avoid have to add directories for all of your modules is to ditch all of the calls to setControllerDirectory (yes, all of them) and to just call: $controller->addModuleDirectory('your_application_root'); This will work if you use the default directory structure, with all your modules located under the application root, like in myapps/admin, myapps/default, myapps/cars etc. Bart McLeod Last edited by mcleod@spaceweb.nl : 03-03-2008 at 09:43 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|