Re: Best Practices in Directory Layout?
| From: | Jaap van Ganswijk | Date: | Sat, 31 May 2003 00:53:32 +0000 |
| Subject: | Re: Best Practices in Directory Layout? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149628@lists.php.net to get a copy of this message | ||
Hi,
At 2003-05-30 12:04 -0700, motorpsychkill wrote:
>I've wanted to get some input on this for a while... I've recently been
>designing PHP applications using the following directory architecture:
>
>main/
> master php files (e.g. addphoto.php)
>
> includes/
> forms/
> validation/
> process/
I think you shouldn't use plurals, just call them include, form etc.
When you use 'include', you should also consider renaming 'validation'
to 'validate'.
>So, using the addphoto.php example, there would be a file in the forms
>directory that read: addphoto_form.inc
>In the validation directory, there would be: addphoto_validation.inc
>And in the process directory, addphoto_process.inc
>
>The master php file (addphoto.php) would simply pull the form, validate it
>and process it. Now the problem is, as I add more master files (currently
>around 50), the forms, validation and process directories get equally large.
>Would it make more sense to simply allocate each master file its own
>directory like this:
>
>addphoto/
> addphoto_form.inc
> addphoto_validate.inc
> addphoto_process.inc
Like Jim I prefer this second method, because it gives every
application it's own directory. This also makes copying a
project or part of a project and converting it into a new
project easier.
I wouldn't reuse the name of the project in the name
of the file, because it makes copying and renaming
the files and converting it into a new project harder.
This also goes for the main file I think, so you also
shouldn't call that addphoto.php but call it index.php
instead.
Greetings,
Jaap
-- Chip Directory
-- http://www.chipdir.biz/
-- http://www.chipdir.info/
-- http://www.chipdir.net/
-- http://www.chipdir.nl/
-- http://www.chipdir.org/
-- And about 30 other mirror sites world-wide.
--
-- To subscribe to a free 'chip issues, questions and answers'
-- mailing list, send a message to listguru@fatcity.com with
-- in the body 'subscribe chipdir-L'. About 500 experts are
-- willing to think with you about electronics problems etc.