In Zend, inside the “Library” folder, I have a PHP file that I want to include in another file. How do I do that?! I cannot figure out the root to the library folder.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about study some documentation about Zend autoloading capabilities. There are plenty of options, how to autoload files,which contains php classes.
here you go http://framework.zend.com/manual/en/zend.loader.html
But if you want it plain and simple :
every zend application generated with zf tool should have defined APPLICATION_PATH constant, which is pointing into application folder. So you could use it for constructing absolute path to file
define namespace inside config, e.g. Autoloadernamespace[] = ‘Custom_’. Then if you create inside library class file ./library/Custom/Object.php with class Custom_Object, Zend loader loads this file when you will be creating instance of Custom_Object class (or call static method)
RTFM, there are other things possible …