-- andeeh <[email protected]> wrote
(on Tuesday, 12 May 2009, 03:07 AM -0700):
> Whats the correct way to autoload from the library folder? What do I invoke
> in the bootstrap for version 1.8?

The correct way is to have your library folder on your include_path --
and that's all. The autoloader will then pick this up.

Now, if you have additional prefixes under the library folder -- such
as, in your example below, 'Mylib_' -- you should pass these to
Zend_Application either via your configuration or the options you pass:

    $application = new Zend_Application(APPLICATION_ENV, array(
        'autoloaderNamespaces' => array('Mylib_'),
        ...
    ));

or, in a config file:

    autoloaderNamespaces[] = "Mylib_"

No other action is necessary.

However...

<snip> 

> How would I modify _initAutoload() to load classes under /library/Mylib? 
> 
> for example I have an "action helper" under 
> 
> /library/Mylib/Controller/Action/Helper/MyHelper.php

This is a different question, as you want the helper broker to be able
to find action helpers under that prefix and path. The way to do so is
to create a resource method or class with the following contents:

    
Zend_Controller_Action_HelperBroker::addPrefix('Mylib_Controller_Action_Helper');

and that will automatically find action helpers with that prefix so long
as they're on your include_path. (And, if you add library/ to your
include_path, you'll be fine in your case.)

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to