A Zope product by Christopher Mielack, 2009/2010
This product was designed to be a versatile container-item-combination that allows items to easily be displayed in Zope Page Templates, represent virtually anything and support bilingual (english/german) content input, which makes it easy to maintain items across the different (english/german) versions of webpages, resulting in less consistency issues.
For every instance of the MPIWG Manager a blueprint for newly created items can be defined in the tab “Edit Defaults”.
If for example you want to use the product to post news on a website in zope, you would go about it as follows:
Create an MPIWGManager object, e.g. called “news”
Then, in the “news” object, using the tab “Edit Defaults”, you can preset some datafields that items created in this MPIWGManager will contain by default. Note that these preset fields can also manually be deleted in the item objects if necessary. Go ahead and add 2 new fields by entering “2” in the textbox and clicking “Update”.
The two new properties now should get unique ids, in this case for example “summary” and “story”. Also, the field label (“Feldname”) should be set in both german and english.
After clicking “Update” again, we can go back to the Zope Management Interface and create some Items inside the MPIWG Manager. Go ahead and create one. Immediately, you will see a form, similarly to the defaults manage, that lets you input all the info in both english and german. You could also change the date if you wanted.
Enter some text into the fields, click update, go back to the ZMI, and, if you want, create some more Items.
When you are done creating Items, you can now create a Page Template that displays the news. Create a new Template with the usual HTML
structure and a place where you want the news to appear.
Assuming that the template is placed in the same folder as the MPIWG Manager or inside of it, the following code will loop all of your news item and display them as html:
<tal:block tal:repeat="entry python: here.news.getSortedByDate()">
<h3 tal:content="python: entry.getDate()"/>
<h1 tal:content="python: entry.getInfo('title','EN')"/>
<p tal:content="python: entry.getInfo('summary','EN')"/>
The method getSortedByDate() returns all the items in the manager as a list sorted by date (ascending). The different properties of the Item can then be accessed by using the MPIWGItem.getInfo(…) method. The first parameter is the id of the property, the second one defines the language used (either 'EN' or 'DE'; defaults to 'EN' if left out).
I hope that helps.