[UPHPU] Template engines
jensenw at gmail.com
Sun Oct 8 14:08:47 MDT 2006
On 10/4/06, Mac Newbold <mac at macnewbold.com> wrote:
> Today at 4:11pm, Walt Haas said:
> > I'd be interested to hear from any graphic artists out there what they
> > see as the pros and cons of template engines in general, and Smarty in
> > particular. Are these templates easier for an artist to work with
> > than the equivalent PHP code?
> > I already know the engineering pros and cons, so don't need comments
> > about that aspect of it.
> I'll preface this with the fact that I'm not a graphic artist. But I've worked
> with many of them.
> The bottom line: most graphic designers/artists don't know HTML and don't want
> to learn it. If they do any of it, it's with a WYSIWIG and isn't worth using
> with a PHP app. So a template language won't change the fact that they wouldn't
> be able to manage the HTML themselves anyway.
> What I've seen of Smarty indicates to me that it really isn't all that much
> simpler in syntax than PHP, and is a lot more limited, so even if you had some
> designer working on the HTML, it's probably just as easy for them to use the
> equivalent PHP directly as to use Smarty, as long as you separate out the files
> appropriately. (Variable interpolation, foreach loops, etc, are practically
> equivalent in Smarty and PHP, the Smarty just makes you use a different
The only compelling argument I've found to use Smarty as the template
language is that it's more limited, and therefore will help enforce
the separation of display logic and other logic. I used Smarty for a
couple of months, but like other people have said, it was just a big
pain to have one more language, one more manual to look things up in,
and it was also a pain to have to write my own Smarty plugins to
implement display logic I couldn't do with Smarty alone. I've gone
back to just using PHP for the templates.
> Whether or not you go with smarty, or something else, or just straight PHP, I'd
> still make sure to separate out the look and feel stuff from the application
> logic if they're going to be worked on by different people or different groups.
> There will always be some interdependencies between them, even with Smarty, but
> the more you can limit them, the more flexibility each side will have without
> help from the other side.
> Again, I'm not a designer, so take it with a grain of salt, or a block of salt
> if you want, but I can't remember a single time in the last 5 years where we've
> had a designer that wanted to do the HTML while we did the PHP/MySQL stuff,
> even though Wade was one of the designers we worked with.
> Mac Newbold Code Greene, LLC
> 1440 S. Foothill Dr. Suite #250
> Office: 801-438-0142 Salt Lake City, UT 84108
> Cell: 801-694-6334 www.codegreene.com
> UPHPU mailing list
> UPHPU at uphpu.org
> IRC: #uphpu on irc.freenode.net
More information about the UPHPU