Re: Another Template Engine (code)

From: Date: Thu, 21 Jun 2001 13:17:56 +0000
Subject: Re: Another Template Engine (code)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54729@lists.php.net to get a copy of this message
You may want to take a look at Dreamtime's template engine. I've had pretty good feedback on it so far. The template language supports things like loops, if-then, pre-compiling templates, etc., which makes assembling complex pages pretty easy. We replaced a whole heap of Cold Fusion code with a few Dreamtime templates and a little PHP code during a big conversion job (CF -> PHP) late last year. For example, if you've got a few arrays of values and want to output an HTML table, your PHP code looks like: $names = array("Tim", "Alice", "Dilbert"); $ages = array(34, 36, 37); $t = new DTTemplate("table.html"); $t->set("names", $names); $t->set("ages", $ages); $t->send(); and your template (table.html) could look like: <table> {:each:names} <tr><td>{names}</td><td>{ages+}</td> </tr> {:end} </table> The layer above this, the Page Manager, supports the lists of variable hashes you talked about, so that you can give it a big associative array instead of doing a series of set() calls for each variable. - Tim http://www.phptemplates.org ----- Original Message ----- From: "scott [gts]" <scott@graphictype.com> To: "php" <php-general@lists.php.net> Sent: Wednesday, June 20, 2001 5:29 PM Subject: [PHP] Another Template Engine (code) > i wrote a simple classified and hash-enabled template engine > as a sort-of proof of concept....

« previous php.general (#54729) next »