While some people immediately understand the usefulness of Zope, others don't understand how to apply their skills. In this article, Peyton McCullough explains how to apply the skills to create a simple forum.
All right, let's get to work. Create a folder called "forum" with the title "My Forum." This will be our forum's main folder. All of our forum's files should be created in our main folder. Create the folders 1, 2 and 3 with the titles Category One, Category Two and Category Three, respectively. These are our forum's categories.
Next, we need to create an index page with a list of categories. Before we do that, however, let's create a macro to define a basic layout. If you're not too familiar with Zope Page Templates, a macro provides a common look and feel. Say you wanted every page in your site to have a header and footer, yet you need to update the style of the header and footer frequently. You could simplify this process by using a macro. Create a Zope Page Template named base and insert the following text:
Our macro will allow us to replace "Title" and "Content" with the appropriate text.
Now we'll create the list of categories. Since the separation of presentation and logic is encouraged in Zope, we will use both Zope Page Templates and Python to accomplish this. Create a Zope Page Template object named index_html and insert the following text:
As you can see, index_html calls the file getCategories. This will be a Python script that retrieves the list of categories and formats it. Create a Script ( Python ) Object named getCategories with the following text:
If you are not familiar with Python, this script retrieves the objects in its folder. If the object is a folder, it treats it as a category and outputs a link to the file cat with the category's folder as cat's context.