[ZPT] Re: [Zope] ZPT issues

Tino Wildenhain tino@wildenhain.de
Wed, 06 Nov 2002 17:50:53 +0100


Hi Tom,

this exacly was a problem for my design here to:
ZPT dont implement real inheritance :((

I had success with the following workaround:

1) Master Template - this holds the global layout and things
   which are common to all pages. Its broken up in small macros
   for every constant part.
2) several Temlates for bigger parts of the site, e.g. standard table,
   standard question-box etc. Each in a separate template as it seems
   convenient, die rest is filled in from master template so it looks
   like a complete page - this is just for quick overview
3) Function centric templates - these are for a small group of pages
   or even a single page, like a "type of page". They form a big macro,
   which covers the whole HTML (actually I use <metal:block> tag around
   <html> and strip this in edit-view/ftp/webdav so co-worker cannot
   circumvent the macro)
   Every constant part is assembled there from macros of the master
   template (1) (for example navigation) and macros of the desired
   standard element template(s) (2).
   Every piece of text which should be localized is surrounded by
   define-slots. All other parts remain constant (this also saves
   the app-logic from beeing accidently overwritten)
4) The pages which use their function specific template (3) and only
   allow the slots to be filled, which are mostly text. Usually there
   is one for any language version (I use language negotiation to provide
   the relevant content-language to a user, app-functions get their language
   selection from surrounded page)

>From what I can tell this works pretty well and avoids to repeat things
too often. (Only the global table structure is repeated because of the
unability to do inheritance)

HTH
Tino Wildenhain

PS: this thread should be moved to ZPT list I think. (Sorry for the
cross posting)




--On Mittwoch, 6. November 2002 13:34 +0100 Tom Deprez 
<tom.deprez@uz.kuleuven.ac.be> wrote:

> Hi,
>
> I'm not sure how to implement something with ZPT and need your advice:
>
> I'll do my best to explain the problem, but I'm not sure if I will
> succeed, since it is not easy to show.
>
> I've a site which has several folders, they all follow the same strategy.
> Basicly what you have is a page with the top half some general
> information. The bottom half is split in two 'panes': the left contains a
> list of items, the right contains more information of the selected item.
> People can delete/edit/look a selected item. Depending on what people
> want to do, the right bottom 'pane' has to be different. Every action is
> in a different folder, so the layout looks like:
>
> Root
>   ...
>   Lists
>      Flowers
>          Delete
>          Edit
>          Insert
>      Boats
>         Delete
>         Edit
>         Insert
>   ...
>
> Now, I'm implementing this in PT, but I'm a little stuck here, since it
> seems ZPT can't stack. eg I've a master PT which defines the general
> layout (menus) and contains slots, situated in the root.  The slots are
> toppane (to fill in the toppane) and bottompane (to fill in the
> bottompane). To be correct, I should create a new master page for the
> 'Flowers' & 'Boats' folders, because they have a different layout, namely
> 'top pane', 'bottom left pane', 'bottom right pane'.
> But when I do this, aren't I then overruling the way for what PT were
> designed? If I now want to change the layout of my site, I have to change
> 2 pages (and who know how much more if we go further into detail).
> Changing 2 isn't that bad, however, most of the parts are in fact the
> same! The menu handling etc is the same...
>
> I was wondering if it is possible to have PT which can inherit from
> another PT, but can extend it with new slots/macros. Which is at the
> moment not possible, I think.
>
> Thanks in advance,
> Tom.
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )