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!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |