Re: Re[2]: [PHP] Include file questions
| From: | Tijnema | Date: | Fri, 25 May 2007 18:27:58 +0000 |
| Subject: | Re: Re[2]: [PHP] Include file questions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255668@lists.php.net to get a copy of this message | ||
On 5/25/07, Richard Davey <rich@corephp.co.uk> wrote:
Hi Tijnema, Friday, May 25, 2007, 5:58:46 PM, you wrote: On 5/25/07, Robert Cummings <robert@interjinn.com> wrote:I have actually very big projects, with hundreds of PHP files in the includes folder. I just give them a logical name and it works for me, so if I have for example about 10 scripts(classes) that all relate to file handling, I name them like this class.file.open.php class.file.close.php class.file.read.php class.file.write.php Of course this is just an example, as you don't need a seperate class for file opening.., but you got the point of my file naming now. With this I don't have any problems having 100s of php files in one directory.I don't agree with you, i have includes in includes dir inside my project, images in images, etc. classes in includes dir start with class. configuration files in includes start with config. etc. Oh to work on such little sized sites again :) Not that I'm belittling your projects Tijnema, because I'm not - but I've not worked on a site with a structure that could be that simple for a long time now, I kinda miss it actually!! Hell even the 'images folder' had to be split across multiple servers in the code I finished today.Very. Each directory contains very specific types of code/content. Tracking down where any given function, class, custom tag, behaviour, etc is defined is extremely simple. Cheers, Rob.
A lot of Robert's structure makes complete sense. I never keep libraries inside the webroot that simply don't need to be there. Infact if a script doesn't output anything 'web related' (image, rss, html) or process data from the site, it doesn't need to live in the webroot at all. I use a similar principal for the 'admin' area of the site too, which I'm sure you'd hate ;) but I always code my admin areas so that they can run on an entirely different domain name and/or server if needs be. Only as a last resort do they ever live in /admin, and never will they share libs that the 'public' site uses, they are entirely stand-alone entities. You're right in that it is down to personal preference though :) Cheers, RichIt doesn't need to be there, but I like to have all files for a project in a single folder. And what does make the difference if it doesn't output anything? Tijnema