« Return to Thread: Autoloading modules

Re: Autoloading modules

by weierophinney :: Rate this Message:

Reply to Author | View in Thread

-- Jurian Sluiman <subscribe@...> wrote
(on Monday, 04 May 2009, 02:20 PM +0200):

> I have read some autoloading articles here, but all examples are with no or
> one module. My application has this structure (almost everything is inside a
> module):
>
>
> /application
> /configs
> /layouts
> /modules
> /default
> /admin
> /blog
> /calendar
>
>
> I have read this thread: http://www.nabble.com/Autoloading-module-resources-
> with-1.8-Preview-td22956945.html. It does not end with a conclusion and the
> documentation is not clear about the Zend_Application_Module_Loader.
>
> How can I autoload all my modules? I can create for each module an autoloader
> by scanning the application/modules directory. The thread mentioned above has
> another approach: each module contains its own bootstrap with config. Are
> there any advices about this rather new subject (the manual seems even
> unfinished)?

In each module, create a bootstrap that extends
Zend_Application_Module_Bootstrap, with the class name
<Modulename>_Bootstrap. That will setup an autoloader using
Zend_Application_Module_Autoloader for that module which follows the
recommended directory structure guidelines.

If you need additional configuration per-module, then you're all setup
to do so; otherwise, that's all you need.

--
Matthew Weier O'Phinney
Project Lead            | matthew@...
Zend Framework          | http://framework.zend.com/

 « Return to Thread: Autoloading modules