RE: [PHP] templates with php
| From: | Rasmus Lerdorf | Date: | Mon, 31 Jul 2000 18:41:56 +0000 |
| Subject: | RE: [PHP] templates with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9226@lists.php.net to get a copy of this message | ||
> > My personal approach to this is to use an auto_prepend_file directive
> > that tells PHP to automatically include a PHP script. Then in that I
> > create the various functions and my "template" files are
> > simple PHP files
> > that simply call the functions. ie. <?title()?> <?price()?>
> > <?description()?>
>
> How does that work with having different values for different pages?
Same way your method does.
> Plus, template engines can have added features such as table building.
> Eg:
>
> <TABLE>
> <LOOP NAME="deidre">
> <TR><TD>{stuff}</TD></TR>
> </LOOP NAME="deidre">
> </TABLE>
>
> This could build an entire table with however many rows (dependent on
> whats in the array (or sql result set) $deidre), and the designers still
> have full control on how the table looks. Not sure how you could do this
> with your method (though I've not really thought about it that much
> :) ).
<TABLE>
<?loop("deidre")?>
<TR><TD>whatever</TD></TR>
<?endloop("deidre")?>
</TABLE>
Not very different at all.
And I can guarantee you that this is faster.
-Rasmus