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.People who come to your site want a personal relationship with Elvis. You can provide this by tailoring your site to your viewer's needs and preferences. Let's add the ability to bring new Elvis sightings to the attention of site visitors. This way when a visitor comes to your site they'll immediately know which sightings are new since they last visited.
sightings document to edit it.
View tab to view it.
All the sightings should be marked as New.
Reload the page.
Now none of the sightings should be marked as New. This is because you've already seen them.
sightingsFolder folder to enter it.
DTML Method from the "Select type to add..." list.
Seattle for the id. Since the title is optional and isn't
really needed in this case, leave the title field blank.
Add and Edit button.
Change the contents of the method to:
<p>6/1/2000 -- Seattle</p> <p>Elvis spotted spare changing on Broadway. He denied being the King.</p>
Save Changes button.
Now you've created a new sighting. Let's see if it is marked as new by the sightings page.
sightings document in the
Sure enough our new sighting is marked New.
How does this work? It uses HTTP Cookies. When you visit the
sightings page a cookie is set that records the current time. Then
each time you return to the page sightings that are newer than the
cookie will be marked as new.
Let's look at the DTML for the
sightings page to see how this is
sightings document to view its contents.
The document sets a cookie with this code:
<dtml-call expr="RESPONSE.setCookie('lastVisited', _.DateTime())">
The document checks each sighting when displaying it to see if it is
newer than the
<dtml-if expr="bobobase_modification_time() > _.DateTime(lastVisited)">
You can set cookies with the
The <dtml-if> tag allows you to test conditions.
The DateTime function allows you to get the current time.
bobobase_modification_time method returns the last
modification time of an object.
In the next lesson you'll learn how to create a mail feedback form.
Comments on this lesson? Email feedback.