[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Variables and Advanced DTML
webmaster@zope.org
webmaster@zope.org
Tue, 24 Sep 2002 12:56:56 -0400
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvDTML.stx#2-18
---------------
The request namespace is always on the bottom of the DTML namespace
stack, and is therefore the last namespace to be looked in for names.
This means that we must be explicit in our example about which
namespace we want. We can do this with the DTML 'with' tag::
<dtml-var standard_html_header>
<dtml-with REQUEST only>
<dtml-if zooName>
<p><dtml-var zooName></p>
<dtml-else>
<form action="<dtml-var URL>" method="GET">
<input name="zooName">
<input type="submit" value="What is zooName?">
</form>
</dtml-if>
</dtml-with>
<dtml-var standard_html_footer>
% Anonymous User - July 18, 2002 9:57 pm:
Unfortunately, it's also going to look in just the REQUEST namespace for the URL variable. For a URL this is
probably ok, as it should be part of the REQUEST, but don't get tripped up.
% Anonymous User - July 24, 2002 10:47 pm:
How do you get items into the REQUEST namespace? And is there a complete reference for dealing exclusively
with this item alone?
% mcdonc - July 25, 2002 9:35 am:
REQUEST.set will work. See the Zope help system API reference for the REUQUEST object.
% Anonymous User - Sep. 24, 2002 12:56 pm:
Well, the basic effect of <dtml-with ...> is to push another object onto the namespace, with <dtml-with
object only> restricting the lookup to just this object.
While sufficient to make the example work, this doesn't explain dtml-with (although it makes the impression).
Forward reference, see *Modifying the DTML Namespace*.