Lesson 4. Site Contact Information

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.

Part of running an Elvis web site is getting in touch with Elvis fans the world over. One way to do this is to provide contact information on your site so that visitors can email you. Let's create an email link at the bottom of each page on your site that lets people send you feedback.

  1. Click the Properties tab.
  2. Type mail_link in the Name field.
  3. Type a mail link to your email address (e.g. mailto:me@example.com) in the Value field.
  4. Click the Add button.

You have created a property that holds your e-mail address and that can be used throughout your site. Let's see how we can use this address on each web page by changing the standard web page footer.

  1. Click the Contents tab to return to the list of items in the folder, then click the standard_template.pt Page Template to edit it.
  2. Change the contents of the template to add a mail to link at the bottom of the page:
    <html metal:define-macro="page">
      <body> 
        <div metal:define-slot="body">
        This is where the page's body text goes.
        </div>
        <hr>
        <a tal:attributes="href container/mail_link">mail
          webmaster</a>
      </body>
    </html>
  3. Click the Save Changes button.

We've change the standard Zope page macro. Now let's verify that this change is reflected in our web pages.

  1. Navigate to the home.html template in the lesson4 folder by clicking on the lesson4 location link and then clicking on the home.html page.
  2. Now click the Test tab to view the web site.

Notice that there is now an email link at the bottom of every web page. The email link uses the property you defined and includes the title of the web page as the email subject.

The email link appears on every page because every page template uses a Page Template Macro defined in the standard_template.pt template. Macros provide a way of sharing presentation elements between pages. The standard_template.pt template gives you a convention for making pages share a common structure.

Summary

By consolidating content into components such as a common footer you can provide a uniform look and feel for your web site.

In the next lesson you'll see how to organize content with a collection of Zope objects.