[Zope-Moz] Templates anyone?

Shalabh Chaturvedi shalabh@pspl.co.in
Mon, 28 Feb 2000 23:05:57 +0530


Rik Hoekstra wrote:
>
> I'm not sure I understand your differences between components or something
> 'entirely new'.

Well, actually I'm not fully aware of the capabilities of the component tag -
but from whatever I know, it seems that the problem it would solve would be a
subset of the problem the 'entirely new' thing can solve. Even if this is true,
it doesn't mean that the component-tag should be abandoned in favour of  the
'pattern' mechanism I am thinking of. There might be good reasons for both to
exist.

Few things about the pattern-thingy I have in mind that are different from the
component tag:
  o  It requires special objects (pattern objects) which define dtml patterns.
  o  A pattern object is a kind of 'my own' tag. It allows you to group a
      commonly used dtml 'pattern' and then include it anywhere by using
      just one tag.
  o  There are two 'levels of evaluation'. The first level is when a pattern is
      evaluated into concrete dtml. The second is when the dtml is evaluated.

>                         Sorry if I'm only intruding upon the discussion,
>  but...

It's great - I like to know what everybody thinks.

> I think Martijn Faassen tried to implement something of the sort with his
> ZFormulator (see at his member page)

From the looks of it ZFormulator does seem similar to what I have in mind
although specific to only html forms. I really need to look deeper into it.

> I once thought of adding something similar by using the document template
> 'competitor' in python land, which is HTMLgen (used to be available from the
> python starship (http://starship.python.net/library - it still is I checked)
> and even did a test from an external method. That worked quite well, and
> easy. HTMLgen is an object oriented library for producing HTML pages. A page
> is an object, and so is every tag on it. I never tried to integrate dtml and
> HTMLgen, though, but it coould be a starting point.

What exactly did you try to do? Was it something like you provide a set of
parameters for creating an html table and the html is generated automatically?
Then it is the same I am thinking of doing with dtml. But I feel doing this
should be easier than writing python and using something like HTMLgen.

> SO much for inserting new elements in templates, but what are your thoughts
> about maintaining/editing such object based pages? Should they be
> rendered/partially rendered. If they're rendered, how do you provide a
> general mechanism that keeps them from being edited? How does the editor
> know where the object boundaries are in a template? How does Zope know which
> parts to update and which not?

This is related to your earlier post (object based zope editing: which I had
read with great interest). Again I cannot answer fully, simply because these
things have yet to be thought out. But I can say:

 o  A 'pattern object' will never be accessed directly by a url. It will only
     be included in another object.
 o  A pattern object when 'rendered' produces dtml. Given the same set of
     parameters  a pattern object will always produce the same dtml. So this
     can be done when a document that includes a pattern object is saved. The
     original document will still contain the 'include' tag. If after this, the
     page is again edited and saved, this evaluation (pattern->dtml) will be
     repeated.
 o  The 'object boundaries' are clearly defined because now a 'pattern object'
     is included using *one* tag in the document. Previously there would have
     been a bunch of dtml where now this 'include pattern' tag is used. The one
     tag is the entire object - it's boundaries are the object boundaries.

>
> Rik

Did I make sense?

Shalabh