Skip to content. | Skip to navigation

Personal tools
You are here: Home Members kurt Plone Programming Tutorial PloneProgrammingTutorial

PloneProgrammingTutorial

A general overview of the Plone hierarchy and how to create objects(Dynamic Pages) in this hierarchy.

Plone is a hierarchical object publishing system.  You can use the builtin content types such as "events", "page", "newitem", "folder" and etc from the "Add Type" dropdown menu or you can created your own pages directly under the ZMI.

The best pages are generally constructed in the following order.

  1. Define and register your "external methods" in python in the ZMI(Zope Management interface).  These are secure methods that can access anything python on the OS can.
  2. Reference those external methods in the logic section as a "Script (Python)" object.   This runs python code in the restricted Plone environment.
  3. Create a "page template" and use tal and metal to wrap the "Script (Python)" object and render the Plone templates with METAL calls(simple wrappers to lots of html with TAL in it).
  4. Unkown step;  make a full blown product out of various page templates.

Now I will describe them in the reverse order as page templates are simple in comparison to Script objects which in turn are supposed to be more simple than external methods.

Create a product


Nothing on this part as I haven't even gotten to this part of the guide, but I imagine these are composed of pagetemplates and/or script objects.


Creating a Page Template


Under the ZMI, created this by selecting  "Page Template" from the "Add" drop down list.  You will want to replace the text with TAL contents between the METAL macro definition for undefined "main" slot inside "template/main_template" and of course, you will be asked to provide a name for this object.
<html>
<head>
<title tal:content="template/title">The title</title>
</head>
<body>
<div metal:use-macro="here/main_template/macros/master">
<div metal:fill-slot="main">
Put your tal template code here. It will be rendered under the Plone look and feel.
</div>
</div>
</body>
</html>


Creating a Script (Python) object

  • Script objects run python code in a restricted(apparently secure) environment.  These scripts probably cannot access systems resources directly.
  • Using the ZMI you select "Script Object (Python)" from the "Add" pulldown menu.
  • You write you script....example to come.

Creating an external method objects


  • You write code in python and place it in the filesystem folder for your Zope instance.  For example; /Zope/Instance/external/mypythonprogram.py.
  • Then you have te register that/these method(s) somehow in the ZMI by their name(Ex. registeremailaddress).
  • You then call these external methods, which are defined class methods inside the mypythonprogram.py, from your Script Object or even directly from a tal call(<i tal:content="Python: registeremailaddress(request/emailaddress)  <-  this is not necessarily the correct syntax)


Document Actions
« November 2009 »
November
MoTuWeThFrSaSu
1
2345678
9101112131415
16171819202122
23242526272829
30