Hi Gijs,
Yes, you can implement MVC in all your modules.
In the Front Controller, you can add your module providing the path to its controllers.
Like this:
// In your bootstrap.php
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory(array(
'default' => 'path/to/your/default/controllers',
'blog' => 'path/to/blog/module/controllers'));
Or:
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory('path/to/your/default/controllers');
$frontController->addControllerDirectory('path/to/blog/module/controllers', 'blog'); // Where the first parameter is the path to your module and the second the module name
Your system layout could be something like this:
application/
controllers/ -> The default controllers
models/
modules/
blog/
controllers/
views/
models/
views/
ZF has its own defaults to the system layout to reach the views of the modules registered in the front controller, but it also supports any system layout customization, what can be easily set.
Plugins are different. They add functionality to your action controllers or views, acting as helpers.
To have a better idea on plugins, it would be nice to take a look on how to implement it on the documentation (http://framework.zend.com/manual/en/zend.controller.plugins.html).
I hope this can help you.
Regards,
Ramses
Yes, you can implement MVC in all your modules.
In the Front Controller, you can add your module providing the path to its controllers.
Like this:
// In your bootstrap.php
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory(array(
'default' => 'path/to/your/default/controllers',
'blog' => 'path/to/blog/module/controllers'));
Or:
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory('path/to/your/default/controllers');
$frontController->addControllerDirectory('path/to/blog/module/controllers', 'blog'); // Where the first parameter is the path to your module and the second the module name
Your system layout could be something like this:
application/
controllers/ -> The default controllers
models/
modules/
blog/
controllers/
views/
models/
views/
ZF has its own defaults to the system layout to reach the views of the modules registered in the front controller, but it also supports any system layout customization, what can be easily set.
Plugins are different. They add functionality to your action controllers or views, acting as helpers.
To have a better idea on plugins, it would be nice to take a look on how to implement it on the documentation (http://framework.zend.com/manual/en/zend.controller.plugins.html).
I hope this can help you.
Regards,
Ramses
On Wed, Sep 24, 2008 at 1:42 PM, gijscom <gijs@gijs.com> wrote:
Hello,
I am just getting to know zend framework a bit. But as all the other MVC
frameworks i am missing some things or i just use the wrong phrases like
modules and plugins wrong or it's something else i can't understand.
I understand the whole mvc concept, but just for one "module" like blog. But
a blog post could have a survey that als should be mvc or the last 10 most
read articles should have a mvc.
I just don't know how to fit these small module/plugins in the whole
"normal" mvc concept.
I started the project with the conventional modular dir structure like:
http://framework.zend.com/manual/en/zend.controller.modular.html
But i understand that modules like blog, news forum etc are big modules that
are applications on there own. How can i fit/create the small "modules" like
a survey or shoutbox. Well all the stuff you can put in a sidebar that have
there own mvc module so you can re-use them.
I think i am just searching for the wrong phrases like modulair and plugin
so if you can get me started that would be nice. A code example on how to
load these modules would be even better ;)
Regards Gijs
--
View this message in context: http://www.nabble.com/Possible-noob-question-about-mvc-and-%22modules-plugins%22-tp19644050p19644050.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论