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.
We're now on the final part of our forum system: replies. As I said eariler, each reply will have its own file within the topic's folder. Create a Zope Page Template object named topic in our forum's main folder and insert this into it:
This calls the file getReplies in the current context and then outputs a forum to add replies. The form sends its data to the file newReply. This is very similar to the cat file.
The next step is to create a Script ( Python ) object by the name of getReplies. Like the getTopics script, this handles the dirty work. It gathers the replies and formats them, quoting any HTML code and handling linebreaks.
from Products.PythonScripts.standard import html_quote, newline_to_br
The only thing the page does worth noting is that it calls the file addReply in the current context. Create a Script ( Python ) object named addReply. Fill it with the following code:
The script creates a new file in the topic's folder, fills it with the reply and adds an author property, giving it the appropriate value.
Conclusion
Your forum is now fully functional! Go ahead and test it out. Notice how easy it was to create the forum. This illustrates how easy Zope makes the creation of Web applications.
Feel free to expand the forum for extra practice. Now that you understand the basics of creating applications in Zope, you should find it quite easy. Try adding a user database or moderation and administration functions.