Ian Bicking: the old part of his blog


After many attempts I would say: reduce templates to a minimun. In the past I've tried ASP.NET, XSLT and Cheetah (with Webware) to separate code and layout, but I always ended up to have a mess in the (X)HTML. So recently i started experimenting with XHTML and DOM manipulation.

Most of the times what I really need is a "Master Page" concept that hold common elements shared among site pages and a way to children pages to replace blocks in the mater pages with specilized content. This is what Cheetah does, but it should really stop there.

For example in Python it's very easy to generate a [select] and [options] fields plus-item-currently-selected with a list comprehension, but in Cheetah it'is not that compact, you have to use a #for, an #if/#else but doing this broke the WYSIWYG HTML editor. So you have a language that looks quite like Python but lacks of the most advanced (and useful) features. I don't like it.

Also delegate all the presentation to CSS helps a lot. You can changes fonts, background colors and, sometimes, elements position via CSS bypassing XHTML altogether.

To my knownledge there are a couple similar approaches in Python: PyMeld and HTMLTemplate.

Comment on Smart vs. Dumb Templates
by dee