[UPHPU] Template systems

John David Anderson uphpu at johndavidanderson.net
Thu May 3 11:55:09 MDT 2007


On May 3, 2007, at 11:47 AM, Ken Snyder wrote:

> Jared Stevens wrote:
>> Hey all -
>> I'm sure this has been discussed before,  but I want to freshen  
>> the debate. I've used Smarty for a while, but I've often wondered  
>> if there is anything better out there in the world of PHP. I've  
>> briefly used a library called Phastplate, but it seems like  
>> development isn't going anymore on that. I can't find the homepage  
>> for it on the web either.
>>
>> The main thing I like about Smarty is its ability to do formating  
>> and stuff on the fly, as well as the way it can handle arrays.  
>> Once I got the scripting language down, it was really convenient.  
>> I also like how you can use QuickForm together with Smarty and  
>> format forms and stuff.
>>
> I like both Smarty and plain PHP.  When working with a team of less- 
> experienced coders, Smarty is often much better because it forces  
> MVC.  I hate having to teach less-experienced coders that it is bad  
> practice to be doing data processing and defining functions in a  
> php template file.

Smarty is like MVC without the M... which to me is one of the biggest  
parts. :) Smarty's view/logic separation doesn't really constitute a  
real controller pattern either, but I suppose its closer to MVC than  
you would otherwise be.

> I also like the namespacing of Smarty; that is anything inside the  
> template won't conflict with other global php variables.  I liked  
> it so much, in fact, that I wrote a QuickTemplater class that uses  
> extract() to do the same thing for plain php templates. (see http:// 
> pastie.caboo.se/58630).

Any MVC setup worth it's salt let's the view layer have it's own  
namespace as well.

-- John


More information about the UPHPU mailing list