Re: Smarty vs PEAR::HTML_Template_IT

From: Date: Tue, 17 Dec 2002 12:28:00 +0000
Subject: Re: Smarty vs PEAR::HTML_Template_IT
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3016@lists.php.net to get a copy of this message
Katana wrote: > >> 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 > Hi all, Thanks for your input. If you want to use templates the designer (and the programmer ofcourse) HAS to learn something about some template system (obviously) . The way I work now, is that I let the designer create the HTML pages in whatever editor he/she likes and when my programming is almost finished I take the HTML pages and cut them up into headers, footers, menus etc and replace "dummy text" in the pages with variables or loop and echo statements that will be filled with real data (from a DB or whatever). This process doesn't take me too long and works, but it is of course far from ideal. Especially when the designer wants to change things and doesn't know how anything about loops and other PHP code. I allways have to assist the designer in changing the pages or worse - do it myself. I'm more in favor of the "Smarty philosophy" I think, becuase I agree that there is such a thing as presentation logic and it is the designer's responsibilty to work with that. But this is unfortunately not always the case. And I'm also not quite sure how Editors like Dreamweaver will handle Smarty's {img} tags. You can't really tell a designer to start using a code editor, just because you want to use a template system, I mean, you don't want people telling you to use Notepad instead of your favorite IDE too. So all in all I still don't know if I should bother the designer (and myself) to learn how to use a template system, especially when it is as complex as Smarty is. Have you worked with designers and taught them how to use a template engine? What was your experience? This should probably go to a different mailling list, but hey, the discussion started here ;-) Jeroen

« previous php.pear.general (#3016) next »