[Zope] DTML Documents vs. Methods--Again? Yikes!

Rik Hoekstra hoekstra@fswrul.fsw.leidenuniv.nl
Fri, 20 Aug 1999 09:50:13 +0200


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Tim
> Wilson
> Sent: Friday, August 20, 1999 6:57 AM
> To: Zope Listserv
> Subject: [Zope] DTML Documents vs. Methods--Again? Yikes!
>
>
> Greetings:
>
> I've been trying to figure out the difference between DTML Documents and
> DTML Methods. I'm reading the available docs, but true enlightenment still
> eludes me. :-)
>
> What are the tradeoffs in using these two seemingly similar objects? For
> example (and please feel free to expound on this), why is
> standard_html_header a DTML method and index_html is a DTML Document? Are
> there ZODB performance issues?
>

The difference between a DTML method and a DTML Document, as I see (used) it
is that
- a DTML Method has no properties of its own because it is a method (except
for title and id). Thus it uses the properties of the object it is called
from. Example: a folder has a property author. If you call author from the
DTML Method it will return the author property of the folder.
- a DTML Document is a _separate_ _object_ with its own properties. To
continue with the example above: if the property 'author' is set in the DTML
Document, calling author in the document, it will return the author property
of the document, not that of the folder.
THere may be a confusion, however, because if the DTML Document has no
property author acquisition will make it return the author property of the
containing folder.

If I recall it well, the DTML DOcument was added later because DTML Methods
did not have properties of their own.

The difference in behaviour make DTML Methods most useful for separated DTML
code (such as a reusable tree or index) to be included in other documents.
Thus if you have a folder with both DTML Methods and DTML Documents, where
the DTML Documents contain the content and the DTML Methods only code, you
can create a folder index which only lists contents by creating a DTML
Method (called 'index' or something) which lists only DTML Documents.

Does this make it any clearer?

Rik Hoekstra