[Zope] HTML formatting overlooked
Evan Simpson
evan@4-am.com
Sun, 22 Aug 1999 15:02:36 -0500
Tim Wilson wrote:
> Your suggestion worked perfectly. Thanks. I understand the statement
> pretty well as it was originally written, but I don't see what the
> purpose of the added '(this(),REQUEST)' is (other than to make my page
> work correctly :-). Could someone explain this.
<dtml-var ...> operates in two very different modes. In name mode (<dtml-var
name="eric"> or just <dtml-var eric>) it fetches the named object and renders it
in the default context (current object and request). In expression mode
(<dtml-var expr="eric"> or just <dtml-var "eric">) it evaluates the expression
and then tries to convert the value into a string if it isn't one already. You
are using expression mode (you had to!), and your expression returned a DTML
object. The string value of a DTML object is its raw source code, conveniently
html-quoted so that your browser will show it correctly. In order to get the
result you want, you have to *call* the DTML object, which you do by placing a
list of parameters in parenthesis after it (eg. "eric()",
"eric(lastname='idle')", etc.). You have to provide the context parameters which
the 'name mode' of dtml-var normally provides, namely the current object 'this()'
as the client and the current request 'REQUEST' as the namespace.