Zope cannot find the tutorial examples. You should install the tutorial examples before continuing. Choose "Zope Tutorial" from the product add list in the Zope management screen to install the examples.
If you have already installed the tutorial, you can either follow along manually, or reinstall the tutorial examples. Note: make sure that you have cookies turned on in your browser.
So we've seen that thesightings
page is built from objects in the
sightingsFolder
folder. How does it work?
Click the sightings
document to edit it.
Change the contents of the document to::
<dtml-var standard_html_header> <h2><dtml-var title></h2> <table border="1"> <dtml-in expr="sightingsFolder.objectValues()"> <tr><td> <dtml-var sequence-item> </td></tr> </dtml-in> </table> <dtml-var standard_html_footer>
Click the Change
button.
Click the View
tab.
Notice how each sighting now has a box drawn around it.
What's going on? The <dtml-in> tag iterates over a list of
objects. The <dtml-var sequence-item>
tag inserts the
current object. The expr="sightingsFolder.objectValues()"
part of
the <dtml-in>
tags tells it how to get a list of objects. It
calls the objectValues
method of the sightingsFolder
folder.
objectValues
returns all the objects contained by a folder.
Summary
You can programmatically build web pages with groups of objects by looping over them and inserting them.
<dtml-in> iterates over a list of objects.
<dtml-var sequence-item>
inserts the current object
when looping over a list of objects.
You can get the contents of a folder by calling its
objectValues
method.
In the next lesson you'll learn about how to manage and display pictures.
Comments on this lesson? Email feedback.