Savant Article in PHP-Mag

My article on Savant has been published in the 01.2005 edition of International PHP Magazine. I subtitled it “How I learned to stop using Smarty and love PHP for template markup” (so what if I love old movies?).

In the Development track, Paul Jones elaborates on how he learned to stop using Smarty and love PHP for template markup. He holds forth on Savant, a lightweight, object-oriented, fast and powerful solution that leverages the power of PHP markup with the convenience of plugins and path management รขโ‚ฌโ€œ all without compiling.

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving your codebase, all while keeping it running the whole time.
Share This!Share on Google+Share on FacebookTweet about this on TwitterShare on RedditShare on LinkedIn

3 thoughts on “Savant Article in PHP-Mag

  1. I very much like the idea behind Savant, and I’ve contemplated using it on a number of occasions. But I’ve been using Smarty for quite some time and very much enjoy many of its features.

    I think I’d be more willing to give Savant a more thorough test spin, but, to tell you the truth, I’m very much put off by the constant put-downs of Smarty that you make. I realize that you do not like Smarty, and that you see no need for Smarty when using PHP — but what I’d rather see is:

    * why you feel templating is useful in PHP (you must find it useful, as you continue to develop Savant)
    * what differentiates Savant from Smarty, and what features/lack-of-features make it an improvement — and why

    Template languages have been around for a long time — Perl has a rich tradition of them, for instance — and they have a reason for their existence. One of these is specifying a domain language — when used in the web idiom, they are to provide minor functional additions to the markup language without requiring the overhead of learning an entire language (such as PHP or perl). Certainly, Smarty can be considered a bit bloated — but just because Smarty provides a number of features and language constructs does not mean you must use them. I often find myself rolling out HTML for selects or multi-tiered checkbox arrays in my scripts and passing them in their entierty to the template — simply because doing so seems to be better done at that level rather than at the template level.

    I challenge you to elaborate more on why using PHP as a template language is A Good Thing (TM), and how using Savant doesn’t violate this idea — as well as why using Savant may in fact be Another Good Thing (TM) in its own right. Just stop with the Smarty is bad tack.

  2. Hi, Matthew —

    Quick response now, perhaps a longer entry later.

    I’m glad you like Smarty; for me, it’s just not a very good tool. As to why Smarty might be considered a misguided effort, others have said what I believe much better than I can; their words are the reason for me writing up Savant in the first place. Links to their essays are available on the front page of the Savant site, but I will re-post those links here for convenience:

    Harry Fuecks

    Brian Lozier

    If these two articles fail to illuminate why I prefer the Savant approach over the Smarty approach, then there is probably nothing I can add to them to convince you. As Monte is fond of saying, “Use the best tool for the job” — and I must add, “To each his own.” ๐Ÿ™‚

  3. I dont like Smarty nor Savant. Instead I prefer the following template engine:

    function getRenderedTemplate($safe_namespace_file, $safe_namespace_data = array())
    {
    extract($safe_namespace_data);
    unset($safe_namespace_data);
    ob_start();
    include $safe_namespace_file;
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *