Hi Randy,

> ...
>    I figured this would be easy to do with Zope.  I created a subdirectory
> called "modules" and put some modules into that; for example, "leftbuttons"
> is a dtml method containing a table data block which contains the standard
> left menu button HTML.  I figured I could whip up a page and at the
> appropriate place in that page, do a '<dtml-var "modules.leftbuttons">' and
> have that code inserted into the page.
>    That was my thinking.  "leftbuttons" views properly by itself.  However,
> when I try that dtml-var statment above, the page displays raw HTML.

try the following:

<dtml-var "modules.leftbuttons()">


<dtml-with modules>
<dtml-var leftbuttons>

the reason for this is: anything inside "" is a python expression,
it is interpreted as if you typed it into an running python-interpreter
(with the zope-context around, of course).
So python calls the ojects __repr__() method here to display it. For
objects __repr__==__str__ (with single quotes arount them)
For some zope objects "self-displaying" means showing their data as

If you use <dtml-var > without the quotes, zope does do some magic with
the __call__() method of the object. Calling a dtml-method renders its
rather then the source.
This is what is done in the first variant.

NB: often you have to provide the documents context to the method, 
so the above call is somthing like <dtml-var
(or such like - have to look again over some documentation or the list
for this)

Tino Wildenhain

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to