|
|||
|
I have a multiple routes in my front controller
$frontController = Zend_Controller_Front::getInstance(); $frontController->throwExceptions(true); $frontController->setControllerDirectory(array( 'default' => dirname(__FILE__) .'/application/controllers/default/', 'admin' => dirname(__FILE__) .'/application/controllers/admin/', 'user' => dirname(__FILE__) .'/application/controllers/user/', 'error' => dirname(__FILE__) .'/application/controllers/error/' )); in that case if i write http://localhost/admin/ its loading the controller from the application/controllers/admin/ directory and that is normal but view is loading always form the /var/www/html/application/controllers/views/scripts/ In that case i can not have a different templates for the diferent routes. That loooks realy strange. Obviously i miss something in general. |
|
|||
|
I'm having the same problem. I haven't been able to figure out where/how to set a module-specific view directory. The default module works fine, but it seems like there must be a way to configure my app so I can place my view files somewhere like this:
./application/views/scripts/admin/index/index.phtml and not this seemingly ambiguous location: ./application/controllers/views/scripts/index/index.phtml Any ideas? |
|
||||
|
Your view scripts should be stored in a folder scheme similiar to this:
....../view/scripts/controller/action.phtml But instead of loading each controller individually, Why not use the Auto Loader? PHP Code:
__________________
- xentek |
|
|||
|
I'm not sure how Zend_Loader applies. My controllers are already loading properly, my problem is that I don't know how to change where ZF is looking for my views.
If you happen to have multiple modules that have the same controller names, what happens? Using 'admin' and 'public' as modules, here's an example: http://site/admin/user/edit and http://site/public/user/edit Both are going to try to pull the view from: .../view/scripts/user/edit.phtml An obvious workaround would be to never use the same name for controllers in different modules, but it seems like there should be a better way to control where views are stored. |
|
|||
|
No, admin is the name of one of my modules. User is the name of the controller, and edit is the action.
I have defined multiple modules in my bootstrap like this: PHP Code:
|
|
||||
|
Looks like you need to organize the view and models for your modules underneath the module directory.
Take a look at the docs: Zend Framework: Documentation In your case it would look something like this: Code:
..../application/admin/controllers/* ..../application/admin/models/* ..../application/admin/views/* And ..../application/public/controllers/* ..../application/public/models/* ..../application/public/views/*
__________________
- xentek |
|
||||
|
No problem. I'm still learning the Zend Framework, and this an area that we're going to be getting into soon (admin section), so I'm glad I could help you work it out... I'll be doing something similar soon!
![]()
__________________
- xentek |
![]() |
| Thread Tools | |
| Display Modes | |
|
|