ZPT Basics (part 4) (
Page 1 of 5 )
In this concluding article, get up close and personal with METAL, the macro language
that allows you to add reusability to your Zope templates.Three weeks ago, I started you off on a tour of Zope Page Templates, explaining
what they were and how they could make your life more interesting. I unraveled
the mystery behind TAL, the attribute language used in ZPT, and TALES, the expression
syntax that allows you to use TAL in a logical manner. I showed you how to place
content and replace text within a template, define variables, create and use conditionals
and loops, and use ZPT's error-handling capabilities
So where that does leave us? At the threshold of the concluding article of this
series, in which I'll be explaining the third component of the ZPT jigsaw: METAL.
METAL, or Macro Expansion for TAL is "...an attribute language for structured
macro preprocessing". Translated, this means that METAL allows you to simplify
your ZPT development with macros, code snippets that can be reused extensively
across one or more templates. The obvious advantage of this: a single change in
the macro will be immediately visible at all places that it has been referenced.
Let's see how it works.