2009年4月24日星期五

Re: AW: [fw-core] Bootstrapping modules with Zend_Application

Matthew Weier O'Phinney-3 wrote:
>
> -- meloniasty <dawid.melewski@gmail.com> wrote
> (on Friday, 24 April 2009, 03:47 AM -0700):
>> Stefan Gehrig wrote:
>> > -----Ursprüngliche Nachricht-----
>> > Von: Matthew Weier O'Phinney [mailto:matthew@zend.com]
>> > Gesendet: Donnerstag, 16. April 2009 13:07
>> > An: fw-core@lists.zend.com
>> > Betreff: Re: [fw-core] Bootstrapping modules with Zend_Application
>> >
>> > -- Stefan Gehrig <gehrig@ishd.de> 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.com
>> > 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.com
> Zend Framework | http://framework.zend.com/
>
>

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?
--
View this message in context: http://www.nabble.com/Bootstrapping-modules-with-Zend_Application-tp23075223p23217104.html
Sent from the Zend Core mailing list archive at Nabble.com.

没有评论: