Integrating external scripts with Zend Framework ?

Answer

In your library directory you should have your own library next to the Zend library folder. Whatever you call it (Mylib, Project, ...) you should include it into the Zend Autoloader and that's done as follows:

require_once 'Zend/Loader/Autoloader.php';
$loader =Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Project_');
$loader->setFallbackAutoloader(true);if($configSection =='development'){
    $loader->suppressNotFoundWarnings(false);}

In order for you library to integrate nicely with ZF and the Autoloader you should stick to the ZF naming conventions. This means two things:

  • if you extend an existing ZF class, replicate the ZF folder structure so that your file has the same path and name except for the library name. E.g. /library/Zend/Db/Abstract.php => /library/Project/Db/Abstract.php.
  • if you write your own classes, still stick to the ZF naming conventions for the autoloader to find them.

All zend-framework Questions

Ask your interview questions on zend-framework

Write Your comment or Questions if you want the answers on zend-framework from zend-framework Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---