-- Jake McGraw <jmcgr...@gmail.com> wrote (on Thursday, 18 March 2010, 07:02 PM -0400): > I'd like to use Zend_Loader_Autoloader::setZfPath() and the > autoloaderZfPath application.ini directive to select a ZF version > based on Environment, exactly as described here: > > http://framework.zend.com/manual/en/zend.loader.autoloader.html#zend.loader.autoloader.zf-version > > What the tutorial fails to cover is how does one introduce > Zend/Loader/Autoloader.php into your executing code without knowing > the desired ZF path/version before executing Zend_Application? It's a > kind of chicken and egg problem. Also, I've noticed that if you don't > use the same version of Zend/Loader/Autoloader.php as the one you > define in your setZfPath, then you'll get a fatal error (duplicate > class) as require_once('Zend/Loader.php') will execute because you're > now operating in a different directory. The only way around this issue > is to remove every instance of require_once from all ZF classes and > rely on Zend_Loader_Autoloader for all file inclusions. > > So, my question is, how are we supposed to use > Zend_Loader_Autoloader::setZfPath() and the autoloaderZf directives?
I'd make the following recommendations: * Have a tree with just Zend/Exception.php, Zend/Loader.php, and the Zend/Loader/ subtree. Stick that on your include_path. This should be from 1.10.0 or later. * Then, in your index.php, setup autoloading and the ZF version. This will ensure that Zend_Application comes from the version you've selected, and should prevent any issues. * Optimally, on all versions of ZF, strip the require_once calls, per the performance appendix. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc