ZPT Basics (part 3) - Endgame (
Page 6 of 6 )
And that's about it for the
moment. In this article, I gave you a crash course in the remaining TAL attributes,
showing you how the "repeat" attribute could be used to iterate over sequences
and replicate the functionality of the standard loop constructs found in other
languages; I also demonstrated how this could be used in the real world, by dynamically
building a Web page from a MySQL database and a single repeating template.
Next, I illustrated how ZPT lets you dynamically define attributes in your Web
page, and also showed you how you could combine this capability with the "repeat"
attribute discussed previously to iteratively build a Web page. Finally, I wrapped
things up with a quick look at the primitive error-handling capabilities available
in ZPT, demonstrating how it can provide a viable - if not very powerful - alternative
to Zope's built-in error handler.
In the next - and concluding - article in this series, I'll be taking you on
a guided tour of METAL, the macro expansion language that forms an important component
of ZPT's reusability. Come back soon for that...and until then, stay healthy!
Note: All examples in this article have been tested on Linux/i586 with Zope 2.5.0.
Examples are illustrative only, and are not meant for a production environment.
Melonfire provides no warranties or support for the source code described in this
article. YMMV!