Ee wrote:
Dears,
In one of the tutorials I read about templates, the writer is diving the code into multiple files. He put the menu, main, left, right, footer each in a separate file. He is using foreach to go through an array and reads all these files.
Is this a good practice?
I use a lot of includes in most of my scripts mostly for logical seperation of libraries. So IMHO yes, that is a good practice. However I wouldn't bother using a foreach to include each file if I know ahead of time what files I'm going to need to call.
Would this slow down the site?
Absolutely! Include(s) and Require(s) are some of the most expensive calls to make, however that can be mitigated by using a compiler cache. Google or check the list archives for some "PHP cache" suggestions.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php