(on Wednesday, 08 April 2009, 10:36 PM +0300):
> Ok, so it's not possible to auto-load modules resources without making a
> bootstrap for each of modules ?
You can, but you have to do it yourself by creating a resource method or
plugin. As an example:
class Bootstrap extends Zend_Application_Bootstrap_Base
{
protected $_modules = array(
'Blog' => APPLICATION_PATH . '/modules/blog',
'News' => APPLICATION_PATH . '/modules/news',
);
protected function _initModuleAutoloaders()
{
foreach ($this->_modules as $namespace => $path) {
$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => $namespace,
'basePath' => $path,
));
}
}
// ...
}
That will create the autoloader for the modules you list; instantiation
registers with the main autoloader instance implicitly.
> > Two things:
> >
> > * First, extend Zend_Application_Module_Bootstrap in your module
> > bootstraps. Part of instantiation includes registering a module
> > autoloader for that module.
> >
> > * Second, use the Modules resource plugin with your application
> > bootstrap. This will search through your module directories for
> > bootstraps and initialize them if found.
> >
> > I'll be getting a full example up soon to make this more clear.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论