RE: [PHP] templates with php

From: Date: Mon, 31 Jul 2000 18:17:22 +0000
Subject: RE: [PHP] templates with php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9219@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? > I never understood why people are so insistent on using something like > @title@ instead of <?title()?> at the cost of an order of magnitude of > performance degradation. Given the right template engine (Shameless plug for my own... :) ) it doesn't have to be a huge degradation. And IMO {title} is slightly easier for "brainless" designers to understand and work around, (eg. One I had to work with didn't know what a file input was, and replaced it with a text input and submit button labelled browse). 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 :) ). -- Richard Heyes http://www.heyes-computing.net/scripts/ Plain text email only please!

« previous php.general (#9219) next »