yet another g33k blog *sigh*

Smarty. Solving the wrong problem since 2001

with 4 comments

Today’s rant is about the Smarty templating system for PHP. A recent blog post by Paul M. Jones has rekindled my strong feelings against Smarty.

Honestly its nothing personal. Its just I can’t believe developers are still using Smarty or that they ever started using it. Unthinkable.

Some background

About 4-5 years ago I stumbled upon Harry Fuecks’ (site is a whole lot different now). It opened up a whole new world for me. I discovered N-tier architectures and Design Patterns (save that for another day). The most significant revelation was the Model-View-Controller design pattern. Finally, I found a proven industry standard for separating Business Logic from Presentation Logic. My life was complete. Hyperbole.

Next steps

I needed a templating system to compliment my new plans for using MVC. I researched the dozens of templating systems out there. Back then I recall 4-5 credible options existed. Of course, smarty was one of the options. But as I read the docs and looked over the examples I soon realized Smarty solves the wrong problem. Instead, I chose phpsavant

Smarty solves the wrong problem

I should explain that statement. Its only right to support a statement like that but I won’t because Paul M. Jones does a better job of explaining it. And I agree with every word.

Smarty book author repents

Hasin Hayder once wrote a book entitled “Smarty PHP Template Programming and Applications”. Soon thereafter he realized “there is no need to use an external template engine like smarty”.

In closing… just Say No to Smarty!

Written by phpslacker

February 5, 2009 at 6:46 pm

Posted in php

Tagged with , ,

4 Responses to 'Smarty. Solving the wrong problem since 2001'

Subscribe to comments with RSS or TrackBack to 'Smarty. Solving the wrong problem since 2001'.

  1. Thanks for the support, Slacker. :-)

    Paul M. Jones

    5 Feb 09 at 6:54 pm

  2. hah. anytime!


    5 Feb 09 at 7:06 pm

  3. After having to deal with a (fairly recent) project that forced me to ‘learn’ Smarty, I’m in definite agreement with this article. Thanks for giving out links to related articles that I’ve missed.

    Do you know what’s up with the phppatterns site? looks like it’s dead with the last update being 2005. any recommendations on sites with patterns?

    Chance Garcia

    9 Feb 09 at 5:40 pm

  4. Hey Chance,

    Thanks for taking the time to comment. You can tell I don’t get much comments :-)

    PHPPatterns has been dead for ages but once upon time it was very useful and regularly updated. I can’t recommend any sites which specifically address design patterns for PHP but a good place to start looking would be Yahoo!’s developer site. And if you don’t mind Java has some excellent articles.

    I can however recommend the book PHP Guide to Design Patterns by Jason E. Sweat. Has excellent examples in php 4/5 and includes unit tests. Its a couple of years old but I still keep a copy within reach. Makes me feel, safe, warm and fuzzy inside


    9 Feb 09 at 8:38 pm

Leave a Reply