[Zope] interpreting DTML
Dieter Maurer
dieter@handshake.de
Mon, 12 Aug 2002 19:21:29 +0200
Please stay on the list...
Ryan Lea writes:
> Second, you say it would be easier to render then highlight, how would
> you go about doing this?
Rendering means "calling".
Please read "Calling DTML objects" in
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
to learn everything about calling DTML objects.
Other types of objects (e.g. Page Templates) are easier to call/render.
> What I was trying to do was to insert styled span tags around the part I
> wanted highlighted, so I would need to do that before it gets rendered.
Why?
You can add span tags after it has been (Zope) rendered.
> Is there a better sequence to do this in that will achieve the same
> result?
>
> what I have is a DTML Method called highlight, that is then called in
> the form "www.site.org/folder/document/highlight". The highlight
> method read in the source of its parent (the document that needs to
> have parts highlighted) then from there I was doing string
> manipulation to highlight the appropriate parts,...
Try the following (assuming, "document" is a DTML object):
hightlight (a Python script, similar for an External Method)
rendered= context(context.aq_parent,container.REQUEST)
# now do your highlighting on "rendered"
...
return rendered
Dieter