Re: PHP vs. PERL (Functional Comparison)??
| From: | Rasmus Lerdorf | Date: | Mon, 17 Sep 2001 04:05:03 +0000 |
| Subject: | Re: PHP vs. PERL (Functional Comparison)?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67556@lists.php.net to get a copy of this message | ||
> I mean, for example say you have
> an html that consists of blocks... Making every block
> an include is clean, but this time, php engine has to
> read all of these includes, and parse the html+php and
> compile/run php everytime a request is made??? I am
> not sure about this?
I wouldn't say it was clean to split everything out into separate files.
I tend to do something more like:
<? include 'logic.php' ?>
<HTML> tags tags tags
<? my_func() ?>
More tags
<? another_func() ?>
More tags
<? footer() ?>
ie. don't necessarily use 1 file per block, create functions that are
defined in a single file and call those instead of including a new file.
If you really do want to separate it, have a look at a cacheing templating
system like Smarty which lets you keep this per-file separation but it
caches the combined logic.
http://www.phpinsider.com/php/code/Smarty/
-Rasmus