views:

134

answers:

3

I'm working on a project now that isn't based on Zend Framework, however I would like to use some of Zend's components in it, namely Zend_Form and Zend_Acl.

The question is, what should I do in order to make these components know how to load their classes correctly when they are instantiated.

I suppose spl_register_autoload and set_include_path should be used, just can't figure out how exactly.


Thanks guys,

Zend_Loader_Autoloader::getInstance() plus setting right initial path in set_include_path did the trick.

A: 

If I understood you correctly, you want to use one copy of Zend Framework in multiple projects. For that purpose, simply edit includePaths.library in your application/configs/application.ini file.

Franz
+2  A: 

If it's just two Zend Framework components you want to use, you could include them manually. What I usually do when I need a few Zend Framework components is to load the via autoloader.

You can find several questions and answers on how to use the Zend Framework autoloader on SO, for example this.

tharkun
+1  A: 

If you do not want to use Zend_Load_Autoloader::getInstance() to let Zend register its autoloader with spl_register_autoload() you just need to put the folder which contains Zend folder on your.

For example if your Zend components are located in "library/Zend" you have to put "libray" on the path, not Zend. Then you can include files like "Zend/Validate/Interface.php" since they are on your path.

Goran Jurić