[Zope] Using DTML methods to provide HTML

Anders Qvist Anders Qvist <quest@valdez.netg.se>
Tue, 13 Jul 1999 18:10:57 +0200 (CEST)


On Sun, 11 Jul 1999, Phillip J. Eby wrote:

> At 01:00 PM 7/11/99 +0200, Anders Qvist wrote:
> >In a DTML document called "authors" I have this situation:
> >
> >  <!--#var "sixfield_page(title='Authors and their works',
> >                          body=authors_body())"-->
> >
> >six_fieldpage is a DTML method which uses two parameters, title and body
> >and returns an entire HTML page. authors_body is a DTML method in the same
> >folder and looks like this:
> 
> Change your call to:
> 
> <!--#var "sixfield_page(_.None,_,title='Authors and their works',
>                           body=authors_body())"-->
> 
> When you call a DTML method in an expression from DTML, you must pass
> "_.None,_" as the first two parameters if you want the current namespace to
> pass through.  Otherwise, sixfield_page will not have access to any
> variables other than 'title' and 'body', period.

Well, what I actually wanted to do was:

<!--#var "sixfield_page(title='Authors and their works',
                           body=authors_body(_.None,_))"-->

but otherwise it worked like a charm. Thanks a bundle! Zope rocks!
 
> I believe there's some more detail on how this works in the DTML reference
> manual.

Well, not in "The expr attribute" section. Possibly elsewhere.

Anders "Quest" Qvist
NetGuide Scandinavia

-- Why suffer scarcity? Look for the Open Source and enter a world of plenty!