This is a typical issue, and the best workaround I can give you is "write your own Zope objects". With this approach you can define what are going to be your content primitives and how their look and feel will be, according to its contents and the context. This is in fact means that you can have as many index_htmls as the number of objects you define. In CMF you do this in a very friendly way by by creating portal types. But if you don't want to trip into canalled waterways, you can write a product on your own. Ausum ----- Original Message ----- From: "Douwe Osinga" <dmo@oberon.nl> To: <zope@zope.org> Sent: Thursday, January 15, 2004 7:52 AM Subject: [Zope] Zope Patterns
Hi Zopers,
I have a musing about how Zope sites are set-up which I would like to share and would very much like comments on.
Typically, a web page has a header, a body and a footer. In most Zope instances, this is translated into standard_html_header, standard_html_footer, while an index_html calls these and does something interesting in between.
I don't like this setup too much, because it explicitly repeats the calling of standard_html_* for every page. If you want to add a parameter to for example standard_html_header (say the css to use or similar), you'll have to change all pages (yes, you can use default parameters, but that is not the point). So I usually end up with a structure like this:
root index_html standard_html_footer standard_html_header mainbody folder1 mainbody folder2 mainbody
where index_html calls header, mainbody and footer. This works great, except for that you need a folder for any page that needs to display the structure. If you want add a method to the root folder that is applicable to everypage, then this method needs to call the structure again.
One could of course create a method that takes as a parameter the contents (mainbody) of a page and than calls the structure methods, but that works clumsy too.
I have been thinking in subclassing python script in a way that it calls index_html and inserts the result of the script in the position of the call to mainbody.
Do other people recognize this pattern? Other solutions?
I'd love to hear.
Douwe Osinga http://douweosinga.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )