Is it possible to load Zend Framework in some external script or system?
For example I would like to use ZF full functionality in my CMS.
Your help would be appreciated.
Is it possible to load Zend Framework in some external script or system?
For example I would like to use ZF full functionality in my CMS.
Your help would be appreciated.
It is possible to include the ZF in any PHP application. As the ZF team states it in the manual the ZF components are loosely coupled so you can use only certain parts of the library in your application.
What I usually do is I stack the ZF's autoloader to the spl_autoloader and register only the "Zend_" name space with the ZF autoloader. In that way if your CMS' autoloader fails to include the ZF class you are using its gonna proceed to the Zend's autoloader that will do the job.
If you want to use the MVC of ZF for certain request in you CMS it is also possible, although is a bit tricky.
I did include ZF once in a Joomla 2.5 component. In most CMS' any module, component, plug-in, etc, is executed by including one file and whatever is in that file will be proceeded.
With Joomla I simply took the Zend_Controller_Front and dispatched it in the above mentioned file. I attached one plug-in (extending Zend_Controller_Plugin_Abstract) to the front controller on the preDispatch hook (method) and I set the controller, action and module (if any) manually in that hook, taking information from php's $_GET or $_POST depending on how your CMS processes requests.
Setting the ZF autoloader in the beginning of your script and unsetting it in the end will do the job of including the necessary files for ZF to work.
Don't forget to include the ZF in PHP's include path.
Hope this chaotic post helps :)