Everyone probably knows this, but PHP's Smarty template engine (http://www.smarty.net) is really awesome.

I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in.

I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

I enjoy using Hiccup more than any template engine I've used previously. Before I met (Clojure and) Hiccup[1], I would have said the same regarding Coffeekup[2].

But what's really amazing is when you combine Hiccup with Enlive[3]. Enlive can give you a headache when you first start working with it, but then there's an almost magical "aha!" moment, and not long after that you'll never want to look back. By "combine" I mean using Hiccup and metadata from your db (or whatever) to generate empty, logic-less views and then using Enlive to bind in your data.

Combine those steps with your own macros and HOFs, look for some choice places to memoize function calls, and now you're cooking with gas.

[1] https://github.com/weavejester/hiccup

[2] https://github.com/mauricemach/coffeekup

[3] https://github.com/cgrand/enlive