On 27 Apr 2009, at 19:37, Bart McLeod wrote:



Matthew Weier O'Phinney schreef:

-- Bart McLeod <mcl...@spaceweb.nl> wrote
(on Monday, 27 April 2009, 06:11 PM +0200):

For all of you who are also wondering what is needed to replace the good old

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoLoad();

This is what is needed in it's most basic form:

require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance()- >setFallbackAutoloader(true);


In most cases, you won't even need to call setFallbackAutoloader(), btw.

I tried immediately, but in my case I need it. What does it do actually? Will look that up in the manual.



I needed setFallbackAutoloader() too so that my other libraries in the library/ folder that follows the PEAR class naming convention continued to autoload.

Another alternative is to use something like this:

        require_once 'Zend/Loader/Autoloader.php';
        $loader = Zend_Loader_Autoloader::getInstance();
        $loader->registerNamespace('App_');
        $loader->registerNamespace('BRI_');


I can't emphasise enough how important it is to also do:
        
        $loader->suppressNotFoundWarnings(false);

whilst in development! Otherwise you get a blank screen when the autoloader fails to load a file because there's a syntax error (or the signature of an interface function has changed)!


Regards,

Rob...


Regards,

Rob...


Reply via email to