views:

200

answers:

2

I have a folder with custom classes in a ZF 1.10 application. The folder is located in /library. How can I tell ZF where they are? Both application.ini and index.php set the path to the library but then ZF can't find the files.

Thank you

+1  A: 

Check out this older Zend Framework tutorial from Rob Allen, specifically on page 4, where he talks about the bootstrapper. His newer tutorials, as excellent as they are, appear to rely on Zend Tool to do the application creation and gloss over this.

One thing that alarmed me, however, was that you mentioned that the folder you're trying to include is public/library. Unless you intentionally want to share your code with the world, I would strongly suggest you place it elsewhere...unless you've got a different "public" folder not shared with the public (in which case you may want to consider renaming it to avoid future confusion).

Cal Jacobson
Thank you, Cal. Sorry, I don't have the library in the public directory. It's just a mistake. It's in the "root" directory.
curro
Rob Allen tutorial relies on ZF 1.5. The version I'm using is 1.10. Although it creates a Bootstrap file, the Bootstrap class is empty. Everything works fine except for the custom classes. I have the ZF library in another place and have PHP include path point to it.
curro
The meat and potatoes of it should be set_include_path, which I would think you could at least place in the empty bootstrap class. Also, Rob has updated tutorials through 1.10 on his site.
Cal Jacobson
A: 
  1. Follow PEAR naming conventions
  2. Add your dir to include_path using set_include_path()
  3. $autoloader->registerNamespace('YourOwn_');
  4. (eventually) Set up module autoloader or resource autoloader.
takeshin
Thank you takeshin, it worked! The "$autoloader->registerNamespace(.." dit it!
curro