Re: Re: Templating engines

From: Date: Mon, 02 May 2005 17:02:44 +0000
Subject: Re: Re: Templating engines
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-214333@lists.php.net to get a copy of this message
Mattias Thorslund a écrit :
Then I wonder what makes skol29 think PHP's "basic template features" are "too poor" to be used seriously? I think PHP's "basic template features" are phenomenal.
PHP is a nice and powerfull scripting langage oriented for Web developement. Let's look at what's it can do as a Template Engine. -> place data items in a template: HTML ... <?php echo $myvar ?> ... HTML -> repeat a zone with data items (*): HTML ... <?php for ($i=0;$i<=$iMax;$i++) { > HTML ... <?php echo $myvar[$i] ?> HTML ... <?php } ?> -> Hide or display a zone: HTML ... <?php if ($test) { ?> HTML ... <?php } ?> -> include an external part or subtemplate: HTML ... <?php include('subtemplate.php') ?> ... HTML And that's it. I think you cannot do more without coding HTML with PHP commands, which wouldn't be making a template anymore. (*) Note that FOR and FOREACH are the only way for repeating a zone of a template with basic PHP commands, and that's aleardy an algorithm. While placing locators into a template shouldn't mean coding. This is at the limit of template feature. --------------------- Skrol29 www.tinybutstrong.com ---------------------

« previous php.general (#214333) next »