Domain Specific Templates

December 22nd, 2002

Rasterweb, whilst musing on PHP and Perl asked:

I think the biggest strength of a system like Movable Type is that the templating system is so powerful and easy to use. Is there any PHP based CMS/weblogging tool that uses templates in a way even close to how Movable Type does?

To which aaron responded:

php does have a decent template system called ‘Smarty’

And I’ll be the first to step up and agree, Smarty is a fine tool, it lacks the amazing flexibility and elegance of Template Toolkit, but thats frosting, and it stacks up nicely compared to Velocity and Cheetah. (more on this theme)

That said, its nothing remotely like Moveable Type’s template system, which I find novel and nearly perfect. As a programmer, with Template Toolkit at my fingers, I tend to think of a template as procedural language for describing presentation. This is the same idea behind PHP and JSP.

MT does something totally different, it defines a domain specific templating language for laying out a blog. I’ve read about domain specific languages in school, but its not until seeing both how elegant, and powerful it can be did I finally understand the appeal. (I’m still not willing to concede the point that Haskell is just plain weird) This is the same idea as JSP’s Taglibs, but without the ugly syntax.

I occasionally run into the limits MT’s language, wishing I had a more flexible conditional, or not operator, but it makes more sense then any approach I’ve seen, and I’m trying to incorporate it into the rewrite.

ps. PHP does have ImageMagick bindings, check out the new PHP Imagemagick extension.

Comments are closed.