Re: Template system in PHP

From: Date: Tue, 12 Feb 2008 21:02:23 +0000
Subject: Re: Template system in PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-269195@lists.php.net to get a copy of this message
Shawn McKenzie wrote:
Ryan A wrote:
Add my vote too for Smarty.... HTH, -R
      ____________________________________________________________________________________
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
I like smarty and it's very powerful, however what you find is that it's just a less capable replacement for PHP. If I want conditional statements to display HTML and/or loop through arrays, why would I want to do it in smarty tags? Instead of moving display away from logic, it just replaces the logic with a different language. When I use templates I pretty much want variable substitution. My next project I'll probably use HTML files with little bits of PHP echos etc... sprinkled throughout. -Shawn
re: If I want conditional statements to display HTML and/or loop through arrays, why would I want to do it in smarty tags? Things are very different when there are a team of varyingly skilled people on the job, do you really want a junior designer going in and changing bits of a php application, when you could limit the damage to a smarty template? further; the font end smarty language is definately needed; concider {if $articles} {*loop through articles and show in table *} {else} {* show no articles message *} {/if} in my opinion, being able to dump that kind of ultra simple logic onto the designers makes: 1: my life much easier 2: my php files much neater 3: my code my "own domain" without worrying about random comments and breakages from designers 4: the designers happier as they have more freedom and power to control the display, without having to worry final note: personally I output every script to a suitably named .tpl file with a single line {debug} - job done

« previous php.general (#269195) next »