Re[2]: [PEAR] Smarty vs PEAR::HTML_Template_IT
| From: | Katana | Date: | Tue, 17 Dec 2002 11:15:42 +0000 |
| Subject: | Re[2]: [PEAR] Smarty vs PEAR::HTML_Template_IT | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3015@lists.php.net to get a copy of this message | ||
>> What is the main difference bewteen Smarty and PEAR::HTML_Template_IT ?
>> Has anyone switched from one to the other and if so, why?
MW> In short: Smarty allows adding program logic inside the template,
MW> HTML_Template_IT does not. In addition, Smarty sort of compiles the
MW> templates to PHP code, meaning that all template variables and logic
MW> are being transformed to native PHP code, so no parsing of the
MW> template is required at runtime -> speed increase.
MW> Personally, I prefer HTML_Template_IT because of a) its ease of use
MW> and b) I´m a strong believer in total separation of program logic and
MW> presentation, so I think no logic should ever be inside a template.
MW> Also, graphic designers often know only HTML (at best) and would have
MW> a hard time learning some sort of template logic markup anyway.
I'm not gonna write again the semi-book I usually write about why I prefer
Smarty and why logic in templates is not that bad, but I'll summarize: I think
that a good backend logic / design separation can not be achieved if you have in
your backend code logic that is only used for presentation. A layout in a
dynamic application is not limited to HTML, but is also made of code. Smarty is
more a display engine than a template class.
But I think that the best method is just to read what Monte Orth has written on
Smarty's site about "Why use Smarty ?": http://smarty.php.net/whyuse.php
Katana