[Zope] How to get (and manipulate) rendered html of a dtml method prior to publishing?

Casey Duncan cduncan@kaivo.com
Tue, 14 Aug 2001 15:29:20 -0600


Richard Ettema wrote:
> 
> Hi,
> 
> How do I get a dtml-method to render its html prior to publishing the page?
> 
> I have a dtml-method which normally is inserted into another page i.e.
> <dtml-var some_dtml> inside index_html.
> This inserts the dtml of some_dtml into index_html, then index_html is
> published, right?
> But I have a single occasion where I need to get the rendered html some_dtml
> would create, prior to index_html being published. I need to retrieve some
> of the html using _.string.split etc. How do I grab the html in such away
> that I can manipulate it??
> 
> I have tried variations of <dtml-var some_dtml html_quote> which gives me
> the html I need, but I cant workout how I can put this into a <dtml-let ...>
> or similar to manipulate. I have tried other ideas but they all return the
> dtml in some_dtml rather than its html, giving me errors.
> 
> Your help on a simple solution (I am sure!!!) will be much appreciated.
> 
> Thanks
> 
> Richard
> 

You need to call it separately and maniplulate the result like so:

<dtml-let rendered="DTMLDoc(_.None, _)"
lines="_.string.split(rendered)">
   ...
</dtml-let>

the key here is he (_.None, _) which is how to call a DTML object from
another object. It's ugly, but it works. 
This would be better implemented as a Python script though... 

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>