Re: template engine...why???

From: Date: Wed, 30 Apr 2003 16:11:22 +0000
Subject: Re: template engine...why???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145810@lists.php.net to get a copy of this message
Hi, Wednesday, April 30, 2003, 11:18:21 AM, you wrote: RA> Hi, RA> I'm a kind of newbie to PHP but have been with Java Servlets for years...I RA> would appreciate it if someone would answer this question for me please. RA> Why use a template engine? RA> isnt it much easier to include a header and footer file with "include"? RA> eg: RA> <?php include "headerblah.php" ?> RA> thats soooo much easier that learning some templating "language"...isnt it? RA> I visited the smarty template site..... RA> Cheers, RA> -Ryan The reason I use a template system is to allow the layout designer complete freedom in how the thing will look. PHP supplies the logic but final layout is developed independently. I use my own system which adds about 8 - 10ms to the page generation (the whole class is 60 lines of code), something i can live with for the added flexibility. One big advantage is we can throw away the header, body and footer includes and just use one layout file which is a lot easier to maintain, its very easy on a complicated site which uses a lot of tables to get lost in the includes. As for learning a new language I get by with just 3 commands and one of those is redundent. What I found is a lot of template systems are trying to be too clever and adding a lot of logic which PHP is better suited to handling outside of html. The bottom line is go with what works for you and your needs but templates sure made my life easier. -- regards, Tom

« previous php.general (#145810) next »