NYCPHP Meetup

NYPHP.org

[nycphp-talk] To Smarty Or Not to Smarty: That Is The Question

Marc Antony Vose suzerain at suzerain.com
Tue Sep 5 10:24:45 EDT 2006


At 8:36 AM -0400 9/5/06, Joseph Crawford wrote:
>I have used smarty and the real questions are
>
>1.) will the site layout change at all?
>2.) will the designer also be a php developer?
>
>I have noticed that when you go with a site which is all PHP and not 
>using a template engine, if you want to change the layout you are 
>going to be there forever.
>If you had a template system it would be as easy as swapping out the html.
>


Joseph seems to be implying that you can't separate logic from 
display unless you use a templating system.  In my opinion, all it 
takes is discipline to separate your display code from your logic.

Put another way:  PHP already is a glorified templating language, 
basically, with a bunch of other stuff added in.  Using smarty or 
constructing your own equivalent system just seems redundant and 
inefficient to me.

I fail to see how {%var_name%} is any simpler for a non-coder to 
learn than <?php echo $var_name; ?>  They are both arcane, silly 
statements that one must commit to memory.

The only real advantage I can see to something like smarty is one of 
security...then your front end coder is essentially blocked from 
using functions you might not want them using, since they can only do 
the things which the templating system allows.

Then again, if you have the coders just learn simple PHP statements, 
rather than silly arcane codes, you are actually teaching them 
something useful in the process, and I find that most coders I am 
paying money to don't seem to want to maliciously undermine my 
projects by doing stuff I don't want them doing.

So, I say: absolutely take advantage of the idea that something like 
smarty gives you, because separating all your data access / massaging 
from your data display is really smart.

But using smarty itself?  I dunno...it's really up to your personal 
preference.  I think it's a waste of time.

Cheers,

-- 
Marc Antony Vose
http://www.suzerain.com/

Never underestimate the power of human stupidity.
-- Lazarus Long



More information about the talk mailing list