[Zope] Re: Rendering DTML from string

Small Business Services toolkit at magma.ca
Sat Apr 3 09:22:12 EST 2004


From: "DaMann" <hammerhead at linuxmail.org>
> Doesn't work <dtml-var "_[someDTMLstrObj]">. I get the raw dtml in page
> source. Which doesn't display in the browser because browser doesn't
> understand DTML tags.

I am not familiar with the object you have stored in local file storage, but
if you have the name of a dtml method stored in a variable (ie. variable
routine contains 'x', where 'x' is the name of a dtml method) then you can
execute that method via:

<dtml-var "_[routine]">


If you have a text file containg dtml code and you want to execute that
code, the only thing i can think of is to place that code into a dtml method
and then execute the method, as follows:

<dtml-call "REQUEST.set('routine', 'tst')">
<dtml-call "REQUEST.set('dtmlcode', '<dtml-var
standard_html_header><dtml-var REQUEST><dtml-var standard_html_footer>')">

<dtml-comment> create the new method </dtml-comment>
<dtml-call "manage_addDTMLMethod(routine, 'atitle')">

<dtml-comment> now put some content into the new dtml method </dtml-comment>
<dtml-call "_.getitem(routine).manage_edit(dtmlcode, 'anewtitle2')">

<dtml-comment> now execute the new method </dtml-comment>
<dtml-var "_[routine]">


To make this work with a text file containing dtml code, just replace the
REQUEST.set('dtmlcode'...  with the code to read your text file and store
the contents in 'dtmlcode'.


HTH

Jonathan




More information about the Zope mailing list