You are not logged in Log in Join
You are here: Home » Members » regebro » ZPT vs DTML

Log in
Name

Password

 

ZPT vs DTML

ZPT vs DTML

There is a never ending war against proponents of ZPT (Zope Page Templates) and DTML (Document Template Markup Language). This Document is an effort to make s short overview over the benefits and problems with both.

I'm sure there are points I have missed. Mail me at [email protected] and I will add to this document.

Zope Page Template Benefits

Editor transparency

ZPT is designed to be transparent to WYSIWYG editors. It is possible to make a template that is editable in a WYSIWYG editor. It's not practically possible to do that with DTML unless you make a Zope specific editor (which nobody has). This is becuase an editor that doesn't understand DTML will show both parts of an dtml-if-else statement, and it will show nothing of a dtml-var statement at all. With ZPT, however, dummy code that will be replaced can be shown in the editor thereby still having the complete page design visible in the editor.

Valid code

ZPT is designed to not only generate valid code, but to be valid code as well, making it easier to validate templates with HTML code validator tools.

Less magick

DTML does a lot of things implicitly. This adds to the code simplicitly, but when you do complex things, it can often result in unexpected side effects, or that things you had expected to work fail. So to use DTML to it's full extent you need to learn and understand all this implicit behaviour, something that isn't trivial. You also need to learn convoluted syntaxes like _. (underscore-dot) that makes little sense to many.

This makes DTML hard to use when you are doing complex things, and it means the learning curve, although shallow, is long. ZPT is instead designed to be clear, explicit (it doesn't do anything you haven't told it too and therefore have a short (although steeper) learning curve.

Can do less

DTML can do more things than ZPT. Some may thing this is actually a benefit for DTML, so I have listed it there too. But proponents of ZPT points out that using DTML to create application logic and send mails breaks the separation between design and logic.

DTML benefits

Easier to start with

Dtml-var and dtml-if is easy statements that are quickly understood by most people. The ZPT statements are more complex, with "span tal:replace" instead of "dtml-var".

Can do more

You can do more stuff with DTML. Some people view this as a benefit, other as an evil break of the wall between between site looks and application logic.