Re: template and file read

From: Date: Tue, 20 Jul 2004 20:08:58 +0000
Subject: Re: template and file read
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191227@lists.php.net to get a copy of this message
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.

« previous php.general (#191227) next »