applications coupled with the realization ZendFramework + Doctrine 1.2 for some time, but now they have their first experience with the use of more modules. I requested a default module is visible to everyone with a certain layout and an admin module with a different layout.
So far in my applications I have always used the following structure:
/app
/application
/acls
/configs
/controllers
/forms
/layouts
/models --> models by doctrine
/generated --> base models by doctrine
/plugins
/views
/Bootstrap.php
/data
/doctrine
/data
/migrations
/schema
/schema.yml
/doctrine.php
/library
/public
/tests
So my question is: how should the structure of my application to do what is required?
I tried using zend tool and see what kind of structure I created the command:
zf create module admin
course after launching
zf create project app
I noticed that the create command module I created a folder modules
in application
.
Into modules
created admin
and inside it has created controllers
, models
and views
.
So in addition to separating means zf controller and view correctly, but also models. But my doctrine creates all the models on the one hand! :D
How can I do to use templates created by doctrine for each module?
Then how do I assign a new layout for the admin module?
For the party guest you advise me to leave the facility that currently use or move it all in a form default
?
Sorry if I made a lot of questions, maybe too much, but I am really very confused about it!
Thanks
After a thorough documentation I've found the right project structure
To view a different layout according to where you are module I used the following plugins:
into Bootstrap.php file
into application.ini file
the plugin described above according to the module in use will set the layout with the name of module.phtml within "layouts/scripts".
How to Autoload forms within a module
add the two below lines to your application.ini file
Create a boostrap file for each module. The file, named Bootstrap.php, should be placed in the root of the module directory and the class name should be {module name}_Boostrap. This bootstrap file will cause zend framework to automatically add the new forms directory to the autoloader.
Add for form class to the /forms directory. A login form would have a filename of Login.php and a class name of {module name}_Form_Login
Call your form from a controller file from within the same module
Simple and effective! ;)