|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Bootstrapping modules with Zend_ApplicationHi everybody,
I'm currently developing the core structure for a new module-based Zend Framework MVC application. In general Zend_Application provides provisions for simple module bootstrapping with its Zend_Application_Resource_Modules and Zend_Application_Module_Bootstrap. But as Zend_Application_Resource_Modules bootstraps all available modules on the application bootstrap I coded my own front-controller-plugin to do a module bootstrapping on preDispatch(). The module bootstraps are all subclassed Zend_Application_Module_Bootstrap classes (I think that's what this class is supposed to do). To cut a long story short: Why do I have to implement Zend_Application_Bootstrap_Bootstrapper::run() in my module bootstrap classes? I think this is somehow needless as Zend_Application_Resource_Modules (on which I based my bootstrapping plugin) only calls Zend_Application_Bootstrap_Bootstrapper::bootstrap(). A run()-call wouldn't make much sense. Perhaps it's possible to implement Zend_Application_Module_Bootstrap::run() as an empty method to allow for more simple modules bootstraps. Just a thought... Best regards Stefan |
|
|
Re: Bootstrapping modules with Zend_Application-- Stefan Gehrig <gehrig@...> wrote
(on Thursday, 16 April 2009, 12:25 PM +0200): > I'm currently developing the core structure for a new module-based Zend > Framework MVC application. In general Zend_Application provides provisions > for simple module bootstrapping with its Zend_Application_Resource_Modules > and Zend_Application_Module_Bootstrap. > But as Zend_Application_Resource_Modules bootstraps all available modules on > the application bootstrap I coded my own front-controller-plugin to do a > module bootstrapping on preDispatch(). The module bootstraps are all > subclassed Zend_Application_Module_Bootstrap classes (I think that's what > this class is supposed to do). > To cut a long story short: > Why do I have to implement > Zend_Application_Bootstrap_Bootstrapper::run() in my module bootstrap > classes? I think this is somehow needless as > Zend_Application_Resource_Modules (on which I based my bootstrapping plugin) > only calls Zend_Application_Bootstrap_Bootstrapper::bootstrap(). A > run()-call wouldn't make much sense. Perhaps it's possible to implement > Zend_Application_Module_Bootstrap::run() as an empty method to allow for > more simple modules bootstraps. Just a thought... This is fixed in trunk. -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
AW: Bootstrapping modules with Zend_ApplicationHi Matthew,
thanks for the quick response. Best regards Stefan -----Ursprüngliche Nachricht----- Von: Matthew Weier O'Phinney [mailto:matthew@...] Gesendet: Donnerstag, 16. April 2009 13:07 An: fw-core@... Betreff: Re: [fw-core] Bootstrapping modules with Zend_Application -- Stefan Gehrig <gehrig@...> wrote (on Thursday, 16 April 2009, 12:25 PM +0200): > I'm currently developing the core structure for a new module-based Zend > Framework MVC application. In general Zend_Application provides provisions > for simple module bootstrapping with its Zend_Application_Resource_Modules > and Zend_Application_Module_Bootstrap. > But as Zend_Application_Resource_Modules bootstraps all available modules on > the application bootstrap I coded my own front-controller-plugin to do a > module bootstrapping on preDispatch(). The module bootstraps are all > subclassed Zend_Application_Module_Bootstrap classes (I think that's what > this class is supposed to do). > To cut a long story short: > Why do I have to implement > Zend_Application_Bootstrap_Bootstrapper::run() in my module bootstrap > classes? I think this is somehow needless as > Zend_Application_Resource_Modules (on which I based my bootstrapping plugin) > only calls Zend_Application_Bootstrap_Bootstrapper::bootstrap(). A > run()-call wouldn't make much sense. Perhaps it's possible to implement > Zend_Application_Module_Bootstrap::run() as an empty method to allow for > more simple modules bootstraps. Just a thought... This is fixed in trunk. -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: AW: Bootstrapping modules with Zend_Applicationhi, i have similar problem with Zend_Application_Resource_Modules (i think so) i'm using ZF 1.80dev my config.ini has: ... resources.View.encoding = "UTF-8" resources.Layout.layout = "default" resources.Layout.layoutPath = APPLICATION_PATH "/layouts" resources.Modules= Cms.resources.Layout.layout="cms" Cms.resources.FrontController= Cms.resources.View.title="CMS " Cms.resources.View.encoding="utf-8" Api.resources.Layout.layout="api" Api.resources.FrontController= Api.resources.View.title="Api" Api.resources.View.encoding="ISO-8859-1" for each module (default, cms, and api) i want to load different layout, but my application initializates 3 layouts and load only cms for any module, and i dont know why? in Zend_Application_Module_Bootstrap is <qoute> if ($application->hasOption($key)) { // Don't run via setOptions() to prevent duplicate initialization $this->setOptions($application->getOption($key)); } </qoute> when i extends Zend_Application_Module_Bootstrap to own Meloniasty_Application_Module_Bootstrap and only i've deleted code above this didnt help because then its load only default so, is there any solution for this problem? thx |
|
|
Re: AW: Bootstrapping modules with Zend_Application-- meloniasty <dawid.melewski@...> wrote
(on Friday, 24 April 2009, 03:47 AM -0700): > Stefan Gehrig wrote: > > -----Ursprüngliche Nachricht----- > > Von: Matthew Weier O'Phinney [mailto:matthew@...] > > Gesendet: Donnerstag, 16. April 2009 13:07 > > An: fw-core@... > > Betreff: Re: [fw-core] Bootstrapping modules with Zend_Application > > > > -- Stefan Gehrig <gehrig@...> wrote > > (on Thursday, 16 April 2009, 12:25 PM +0200): > > > I'm currently developing the core structure for a new module-based Zend > > > Framework MVC application. In general Zend_Application provides > > > provisions > > > for simple module bootstrapping with its > > > Zend_Application_Resource_Modules > > > and Zend_Application_Module_Bootstrap. > > > But as Zend_Application_Resource_Modules bootstraps all available modules > > on > > > the application bootstrap I coded my own front-controller-plugin to do a > > > module bootstrapping on preDispatch(). The module bootstraps are all > > > subclassed Zend_Application_Module_Bootstrap classes (I think that's what > > > this class is supposed to do). > > > To cut a long story short: > > > Why do I have to implement > > > Zend_Application_Bootstrap_Bootstrapper::run() in my module bootstrap > > > classes? I think this is somehow needless as > > > Zend_Application_Resource_Modules (on which I based my bootstrapping > > plugin) > > > only calls Zend_Application_Bootstrap_Bootstrapper::bootstrap(). A > > > run()-call wouldn't make much sense. Perhaps it's possible to implement > > > Zend_Application_Module_Bootstrap::run() as an empty method to allow for > > > more simple modules bootstraps. Just a thought... > > > > This is fixed in trunk. > > > > -- > > Matthew Weier O'Phinney > > Project Lead | matthew@... > > Zend Framework | http://framework.zend.com/ > > > > > > > > hi, i have similar problem with Zend_Application_Resource_Modules (i think > so) > > i'm using ZF 1.80dev > > my config.ini has: > ... > > resources.View.encoding = "UTF-8" > resources.Layout.layout = "default" > resources.Layout.layoutPath = APPLICATION_PATH "/layouts" > > > resources.Modules= > Cms.resources.Layout.layout="cms" > Cms.resources.FrontController= > Cms.resources.View.title="CMS " > Cms.resources.View.encoding="utf-8" > > Api.resources.Layout.layout="api" > Api.resources.FrontController= > Api.resources.View.title="Api" > Api.resources.View.encoding="ISO-8859-1" > > for each module (default, cms, and api) i want to load different layout, but > my application initializates 3 layouts and load only cms for any module, and > i dont know why? > > in Zend_Application_Module_Bootstrap is > <qoute> > if ($application-> hasOption($key)) { > // Don't run via setOptions() to prevent duplicate > initialization > $this-> setOptions($application-> getOption($key)); > } > </qoute> > when i extends Zend_Application_Module_Bootstrap to own > Meloniasty_Application_Module_Bootstrap and only i've deleted code above > this didnt help because then its load only default > > so, is there any solution for this problem? Looking at your config file, you're missing the moduleDirectory directive -- so no modules are being found. -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: AW: Bootstrapping modules with Zend_Applicationthis is only part of my config file, i have moduleDirectory autoloadernamespaces.0 = "Zend_" autoloadernamespaces.1 = "Meloniasty_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpsettings.date.timezone = "Europe/Warsaw" bootstrap.path = APPLICATION_PATH"/../library/Meloniasty/Bootstrap.php" bootstrap.class = "Meloniasty_Bootstrap" pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" resources.FrontController.throwexceptions = false resources.FrontController.params.prefixdefaultmodule = true resources.FrontController.moduledirectory = APPLICATION_PATH"/modules" resources.FrontController.defaultModule = "default" resources.Layout.layout = "default" resources.Layout.layoutPath = APPLICATION_PATH "/layouts" resources.Modules= Cms.pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" Cms.resources.Layout.layout="cms" Cms.resources.FrontController= Cms.resources.View.title="CMS " Cms.resources.View.encoding="utf-8" Api.pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" Api.resources.Layout.layout="api" Api.resources.FrontController= Api.resources.View.title="Api" Api.resources.View.encoding="ISO-8859-1" application works fine with modules but all modules load all settings i have Cms_Bootstrap, and Api_Bootstrap class i.e. http://app.localhost/ - with settings above app load layout 'cms', but i think it should 'default' http://app.localhost/cms/ - load layout 'cms' - its ok http://app.localhost/api/ - load layout 'cms' - itsn't ok, it should 'api' i dont know, maybe zend_application works like that? |
|
|
Re: AW: Bootstrapping modules with Zend_Application-- meloniasty <dawid.melewski@...> wrote
(on Friday, 24 April 2009, 07:04 AM -0700): > Matthew Weier O'Phinney-3 wrote: > > -- meloniasty <dawid.melewski@...> wrote > > (on Friday, 24 April 2009, 03:47 AM -0700): > > > Stefan Gehrig wrote: > > > > -----Ursprüngliche Nachricht----- > > > > Von: Matthew Weier O'Phinney [mailto:matthew@...] > > > > Gesendet: Donnerstag, 16. April 2009 13:07 > > > > An: fw-core@... > > > > Betreff: Re: [fw-core] Bootstrapping modules with Zend_Application > > > > > > > > -- Stefan Gehrig <gehrig@...> wrote > > > > (on Thursday, 16 April 2009, 12:25 PM +0200): > > > > > I'm currently developing the core structure for a new module-based > > > Zend > > > > > Framework MVC application. In general Zend_Application provides > > > > > provisions > > > > > for simple module bootstrapping with its > > > > > Zend_Application_Resource_Modules > > > > > and Zend_Application_Module_Bootstrap. > > > > > But as Zend_Application_Resource_Modules bootstraps all available > > > modules > > > > on > > > > > the application bootstrap I coded my own front-controller-plugin to > > > do a > > > > > module bootstrapping on preDispatch(). The module bootstraps are all > > > > > subclassed Zend_Application_Module_Bootstrap classes (I think that's > > > what > > > > > this class is supposed to do). > > > > > To cut a long story short: > > > > > Why do I have to implement > > > > > Zend_Application_Bootstrap_Bootstrapper::run() in my module bootstrap > > > > > classes? I think this is somehow needless as > > > > > Zend_Application_Resource_Modules (on which I based my bootstrapping > > > > plugin) > > > > > only calls Zend_Application_Bootstrap_Bootstrapper::bootstrap(). A > > > > > run()-call wouldn't make much sense. Perhaps it's possible to > > > implement > > > > > Zend_Application_Module_Bootstrap::run() as an empty method to allow > > > for > > > > > more simple modules bootstraps. Just a thought... > > > > > > > > This is fixed in trunk. > > > > > > > > -- > > > > Matthew Weier O'Phinney > > > > Project Lead | matthew@... > > > > Zend Framework | http://framework.zend.com/ > > > > > > > > > > > > > > > > > > hi, i have similar problem with Zend_Application_Resource_Modules (i > > > think > > > so) > > > > > > i'm using ZF 1.80dev > > > > > > my config.ini has: > > > ... > > > > > > resources.View.encoding = "UTF-8" > > > resources.Layout.layout = "default" > > > resources.Layout.layoutPath = APPLICATION_PATH "/layouts" > > > > > > > > > resources.Modules= > > > Cms.resources.Layout.layout="cms" > > > Cms.resources.FrontController= > > > Cms.resources.View.title="CMS " > > > Cms.resources.View.encoding="utf-8" > > > > > > Api.resources.Layout.layout="api" > > > Api.resources.FrontController= > > > Api.resources.View.title="Api" > > > Api.resources.View.encoding="ISO-8859-1" > > > > > > for each module (default, cms, and api) i want to load different layout, > > > but > > > my application initializates 3 layouts and load only cms for any module, > > > and > > > i dont know why? > > > > > > in Zend_Application_Module_Bootstrap is > > > <qoute> > > > if ($application-> hasOption($key)) { > > > // Don't run via setOptions() to prevent duplicate > > > initialization > > > $this-> setOptions($application-> getOption($key)); > > > } > > > </qoute> > > > when i extends Zend_Application_Module_Bootstrap to own > > > Meloniasty_Application_Module_Bootstrap and only i've deleted code above > > > this didnt help because then its load only default > > > > > > so, is there any solution for this problem? > > > > Looking at your config file, you're missing the moduleDirectory > > directive -- so no modules are being found. > > this is only part of my config file, i have moduleDirectory > > autoloadernamespaces.0 = "Zend_" > autoloadernamespaces.1 = "Meloniasty_" > > phpsettings.display_errors = 0 > phpsettings.error_reporting = 8191 > phpsettings.date.timezone = "Europe/Warsaw" > > bootstrap.path = APPLICATION_PATH"/../library/Meloniasty/Bootstrap.php" > bootstrap.class = "Meloniasty_Bootstrap" > > pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" > > resources.FrontController.throwexceptions = false > resources.FrontController.params.prefixdefaultmodule = true > resources.FrontController.moduledirectory = APPLICATION_PATH"/modules" > resources.FrontController.defaultModule = "default" > > resources.Layout.layout = "default" > resources.Layout.layoutPath = APPLICATION_PATH "/layouts" > > resources.Modules= > Cms.pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" > Cms.resources.Layout.layout="cms" > Cms.resources.FrontController= > Cms.resources.View.title="CMS " > Cms.resources.View.encoding="utf-8" > > Api.pluginPaths.Meloniasty_Bootstrap_Resource="Meloniasty/Bootstrap/Resource" > Api.resources.Layout.layout="api" > Api.resources.FrontController= > Api.resources.View.title="Api" > Api.resources.View.encoding="ISO-8859-1" > > application works fine with modules but all modules load all settings > > i have Cms_Bootstrap, and Api_Bootstrap class > > i.e. > http://app.localhost/ - with settings above app load layout 'cms', but i > think it should 'default' > http://app.localhost/cms/ - load layout 'cms' - its ok > http://app.localhost/api/ - load layout 'cms' - itsn't ok, it should 'api' > > i dont know, maybe zend_application works like that? This shouldn't matter, but... what happens if you lowercase the configuration keys: cms.pluginpaths.... api.pluginpaths.... -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: AW: Bootstrapping modules with Zend_Applicationno, its still doesnt work why in Zend_Application_Resource_Modules all modules are initialized? i think it should only initialize only current module, when i run cms module its should bootsraping only Cms_Bootstrap and load settings from cms, am i right? my main bootstrap is: class Meloniasty_Bootstrap extends Zend_Application_Bootstrap_Bootstrap { } bootstrap for modules are: class Cms_Bootstrap extends Zend_Application_Module_Bootstrap { } class Api_Bootstrap extends Zend_Application_Module_Bootstrap { } this is correct? |
|
|
Re: AW: Bootstrapping modules with Zend_Applicationmeloniasty schrieb: Matthew Weier O'Phinney-3 wrote:-- meloniasty dawid.melewski@... wrote (on Friday, 24 April 2009, 07:04 AM -0700): It initalized all modules, because some modules maybe need other modules to work, depending on your design. And it seems, that 'cms' is simply executed later and so overwrites settings from 'api'. You can write a frontcontroller-plugin to change your layout depending on request. Is that a solution? |
|
|
Re: AW: Bootstrapping modules with Zend_Application-- meloniasty <dawid.melewski@...> wrote
(on Saturday, 25 April 2009, 05:02 AM -0700): > why in Zend_Application_Resource_Modules all modules are initialized? i > think it should only initialize only current module, when i run cms module > its should bootsraping only Cms_Bootstrap and load settings from cms, am i > right? There were two considerations in play when we chose to initialize modules at application bootstrapping time: * Many people write module-specific routing. The appropriate place to define this is at the module level -- which means the module bootstrap must be run at application startup. * Many people will utilize resources from other modules -- for instance, to provide widgets to their layouts. For this to work, autoloading for each module must be setup. Please be aware, however, that you do not need to use the Modules resource if it does not fit your needs -- you can always write your own resource for bootstrapping modules on-demand instead. The resource provided is intended to fit the 80/20 use case. -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: AW: Bootstrapping modules with Zend_Applicationcould you give some examples how to build applications with config in ini file where are settings for different layouts for each modules (2 or 3 modules)? |
| Free embeddable forum powered by Nabble | Forum Help |