Now that you've got the skinny on variables and conditional statements, expand your knowledge of the ZPT universe with this discussion of TAL loops, dynamically-generated attributes and error handlers.
You can also use the "repeat" attribute to hook your template up to a database, and dynamically generate output based on an SQL resultset. Consider the following example, which demonstrates how the "repeat" attribute can be used to iterate through a MySQL resultset and dynamically build a table containing elements of that resultset.
In this example, SelectMembers is a ZSQL method used to retrieve a list of members
from a database SELECT * FROM members as a sequence (for the uninitiated, a ZSQL Method is a special Zope object that allows you to communicate with a database). A ZPT loop iterates through it and prints the data as an HTML table.
Here's what the output looks like:
This example uses the "repeat" TAL attribute to loop over the result set returned by the SelectMembers ZSQL Method.
<tr tal:repeat="memberlist here/SelectMembers">
The TALES expression - "here/SelectMembers" - executes the ZSQL method. The rest
of the code is good ol' HTML to make the page look pretty.