PDA

View Full Version : Template engines


mordred
08-28-2002, 10:42 AM
Hi folks,

I'm currently a little fed up with the way I build my scripts and customized them. Specifically, I'm thinking of employing a template engine for my next projects. So my question is pretty simple and straightforward: Do you have any experience with PHP template engines?

I'm just curious about how to work with them... do they scale easily, is the learning curve accomplishable for the template designer, how stable/extendable are they, how helpful the developer community, the benefits of the application architecture etc.

Currently I'm having a look at Smarty (http://smarty.php.net/). I have to admit that this engine is the first hit on a google search query, and the fact that it's on a subdomain of php appealed to me... ;) I know, not really technical reasons. But the idea of pre-compiling the templates is interesting.

So what are your thoughts/experiences?

firepages
08-28-2002, 01:59 PM
never been sure about templating systems myself.... I have made my own in the past for specific sites but they are not really generic, just specific to the needs of a particular site & administrators (each with their own level of competency)

this is a great thread here and well worth reading voostinds points -> http://www.sitepointforums.com/showthread.php?s=&threadid=67849&perpage=25&pagenumber=1

Smarty is written (mostly I think) by Andrei Zmeivski so one assumes that its as good as it gets, I personally found that it may have made life easier for designers but definately harder for me :) as I like to work to my own logic and many templating systems fragment my code and logic past the point of annoyance, and as Vincent says in the post linked above PHP is a templating system already.. I sort of agree

mordred
08-28-2002, 04:56 PM
Thanks for the link firepages, that was a very good and long read. However I'm left with mixed impressions, especially by voostinds posts. I've read already about his eclipse framework, and I think he's doing a great job with it, but he argues against the complexity and the additonal/useless layer a template engine brings, yet at the same time promotes database abstraction layers and iterator classes... well, I presume this topic is suited to be discussed in a broader manner, as was done on sitepoint.

I have to say that I designed my applications in a similar manner like you did, but I'm feeling somewhat uncomfortable with it now (to roll up one's own quasi-templating system for every new customer). A little bit more structured approach, enhanced through OOP concepts, is what I envision.

Another possibly route for investigation would be XML/XSLT. Though I'm skeptical due to performance questions, and whether this approach would be eventually better realized by a Java solution.

I think I'll play around with Smarty for a while until it's complexity gets on my nervers. :)