[Zope-PTK] Dynamic meta-type based templating ? (was : What is the PTK?)

kamon ayeva kayeva@hotmail.com
Thu, 07 Sep 2000 12:36:53 GMT


Hi,

Bill and Chris asking me to elaborate on templating ideas we are currently 
testing with Maik Roeder and Tariq Krim:
>From: Chris Withers <fresh@bay-c.co.uk>
>To: Bill Anderson <bill@libc.org>
> > > - and some ideas we are currently experimenting about "per meta_type
> > > templating"
> >
> > Elaborate please.
>
>Yes, please do :-)

OK, you asked for it, so here it is, but it is more of a Proof of concept 
attempt.

#####
Goal : Allow easy creation and management of the Presentation Logic for 
sites that have sub-sites (that may also have sub-sites).

Application domains

Community Sites
Vortals
Application Service Providers

Actors

Zope Developer / Administrator
Web Designer
Content Manager

Use cases

Scenario 1: One template (or skin) per object type
- Zope Developer develops a product for the site's Application Logic.
- Zope Developer provides default Presentation Logic within the product.
- Content Manager instanciates site objects with the product.
- During object instanciation, Content Manager chooses to affect a specific 
skin to the object or not to. No specific
skin means that the object acquires its presentation from its container.
- After content object instanciation, Web Designer can access the instance 
skin method where applied and customize it

Scenario 2: Multiple templates (or skins) per object type

- Zope Developer develops a product for the site's Application Logic.
- Zope Developer provides several Presentation Logic methods for each object 
of the product.
- Web Developer provides several skins (i.e. good looking HTML and graphics) 
for each Presentation Logic.
- Content Manager instanciates site objects with the product.
- During object instanciation, Content Manager chooses a/ a skin for the 
object among the available skins, or b/ not to
affect a specific skin to the object. No specific skin means that the object 
acquires its presentation from its container.
- After content object instanciation, Web Designer can still access the 
instance skin method where applied and customize it.

Solution attempt (so far)

1/ Create a method called [ZClass_Name]_Template in the ZClass along with 
its constructor methods.
A patch to the ZClasses product could allow optional creation of this method 
at the ZClass creation. In the case of multiple
skins, create a template method for each. As a convention, you could just 
use ..._Template1, ..._Template2, ...

2/ Add a code snippet in the ZClass 'add' method in order to copy the
template method to the instance if 'Local
Skin option' has been selected. Each copy gets the id
'standard_mptrois_template' (for example). In the case of
multiple skins, the add method should present the available skins to the 
Content Manager for selection.

3/ In the base ZClass DocumentFolderClass, we have an index_html method 
which calls standard_mptrois_template.
So this method is the one that is used for rendering all over the ZDP-Tools 
based site.

4/ The Web Designer can put the generic skin in the [ZClass_Name_Template 
method of the related class and, then
when needed, can customize the standard_mptrois_template of the object 
instance.

Go for your feddback.

Regards,
Kamon

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.