-- Jason DeBord <[email protected]> wrote
(on Friday, 13 February 2009, 07:06 PM +0100):
> Directory Structure
> 
> Project
> 
>   Application
>     controllers
>     views
>     models
>     layouts
>     forms
> 
>   Library
>     symlink to Zend
> 
>   public_html
> 
> So I set my include path to Project/library so The Framework is
> included. I am thinking that it makes sense to put classes for the
> database or other "model" type stuff into the models directory and
> classes for forms in the "forms" directory.
> 
> Questions
> 
> 1) Does this file structure make sense?
> 2) How are you guys setting up your directory structures?

Please see the recommended directory structure proposal (which has been
accepted):

    
http://framework.zend.com/wiki/display/ZFPROP/Zend+Framework+Default+Project+Structure+-+Wil+Sinclair

It's not much different from yours. One note is that all directories are
lowercase typically; additionally, we call the directory simply
"public", not "public_html".

> 3) Is it correct that I will have to add include paths for any
> directories I want to put classes in? ( models and forms in my
> structure above )
> 4) I don't want any more include paths than absolutely necessary,
> right? So what is the most logical / efficient way to set this up?

For now, yes, adding include_paths is the way to do this if you want to
do autoloading. However, there's a couple new tools in the incubator
that will be included in 1.8 which will make this easier,
Zend_Loader_Autoloader and Zend_Loader_Autoloader_Resource. The latter
class has a variant in Zend_Application_Module_Autoloader, which follows
the recommended directory structure above, and allows you to simply
specify a namespace prefix and base path, and automatically load
resources as long as they follow specific conventions.

You can find more information on these proposal pages:

    
http://framework.zend.com/wiki/display/ZFPROP/Zend_Loader_Autoloader+-+Ralph+Schindler
    
http://framework.zend.com/wiki/display/ZFPROP/Zend_Loader_Autoloader_Resource+-+Matthew+Weier+O'Phinney

Code for both proposals is complete and tested in the incubator at this
time.

-- 
Matthew Weier O'Phinney
Software Architect       | [email protected]
Zend Framework           | http://framework.zend.com/

Reply via email to