Now that Stan has completed the first part of this task, he has to create a simple company Web page. This page will link to the newly created Folders, will contain a company logo and will indicate when the full site is expected to come online. First, Stan needs to find a company logo graphic to use in the home page. With some help from the graphics department, he finds a disk containing the logo. Now, all Stan has to do is get the logo into Zope, in particular into the ZAcme Folder. Stan creates an Image object in the ZAcme Folder by completing the following steps:
|
Stan's next task is to create a home page. Since the ZAcme Folder was initialized during the Zope installation, it does not contain a public interface, or index_html DTML Method. Thus, he needs to add a DTML Method to the ZAcme Folder. DTML Methods are how information in Zope objects is presented to users accessing Zope as a normal website. By taking on the properties of the objects they are contained in, DTML Methods can be used to manipulate and display the objects' data . To create the DTML Method, Stan does the following steps:
|
<TITLE><dtml-var document_title></TITLE>
<H4>Welcome to ZAcme Web, the official web site of ZAcme Incorporated</H4>
<P>This site is currently under construction. Be sure to visit us soon when the full site is ready. We expect to have information online concerning:
<LI><A HREF="News">Company news and press releases</A>
<LI><A HREF="Products">Company product information</A>
<LI><A HREF="Research">What we have brewing in our research labs</A>
Here we have a simple HTML page with Zope Document Template Markup Language ( DTML ) instructions interspersed with normal HTML text. We use two DTML instructions here:
Tip: Many browsers feature "pop-up" menus, accessed by right-clicking (Windows, OS/2), Control-Clicking (MacOS). When a pop-up menu is brought up on a hyperlink, there may be an option to "Open link in new window." Choosing this option on the View tab opens the rendered DTML Method in a separate window instead of the normal workspace frame. Here the DTML Method can be seen as others will see it.
Except for one thing, Stan needs to put a date in the home page telling when the full site is expected to come online. He could do this manually by entering a date into the home page DTML Method. However, if the date was entered manually in other pages, then a change in the expected date would require a great deal of editing. Fortunately, by using DTML and Folder properties, the expected date can edited in all the pages by editing only one date. Stan takes the following steps:
|
Stan needs to add a Date property. He goes to the add property portion of the screen and gives this property the id, expected_date . He then selects the type "date", types in a value of January 27, 2000 and clicks "Add". The screen refreshes with a new property named expected_date . Note that the date appears in the format 2000/01/27 . This is because it is a Zope date-time value and Stan chose to have the property be of type date instead of string. Zope date-time values can be formatted and calculated according to the rules of dates and times. Now, whenever the expected date needs to be changed within the home page, Stan can easily make the change here.
<P>The full site is expected to come online on
Since expected_date is a property of the Folder containing the home page, it can be accessed in a dtml- var tag. In Zope, expected_date can also be accessed in a dtml-var tag within DTML Methods in sub-folders. This technique, known as acquisition , is one of the unique features of Zope. Acquisition easily allows information sharing across a website.
Previous Chapter | Up | Next Section | Contents