Another Smarty Emigrant

This guyHasin Hayder has finally realized that there’s no need for Smarty’s template language any more (even after writing a book about Smarty).

Harry Fuecks and Brian Lozier made the same conclusion four years ago, and based on those articles, so did I. It turns out that Smarty tries to solve (mostly) the wrong problem

You may have heard that you need to keep your PHP and HTML separated, but that’s not quite the case. Instead, what you need is to keep your "business logic" separate from your "presentation logic", and that’s a different thing entirely.

Thus, all that’s required is a way to keep your views and controllers separated, and perhaps provide helpers for common view tasks. Then you can use plain PHP in your view scripts (templates), without needing a whole new language.

That line of thinking led me to write Savant first in 2004 (and versions 2 and 3 later), along with its more-recent ideological descendants Zend_View and Solar_View. Even the Cake and Symfony guys got the point early on (and — dare I say it? — the Rails crowd as well with eRB templates).

It’s so funny to see the comments in Hasin’s article; all the same old tired arguments come up. Here’s the deal: if you think you need to protect your business logic from your graphic designer, you don’t have a technical problem, you have a hiring/management/training problem.

Update (2008-01-11): Apparently some readers thought “this guy” in the first paragraph meant me; changed it to “Hasin Hayder” to be more explicit. (I’m looking at you, Kimsal.)