[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Dynamic Content with DTML

nobody@nowhere.com nobody@nowhere.com
Sat, 31 Aug 2002 16:21:05 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/DTML.stx#2-88

---------------

    Suppose we're running a special. First time zoo visitors get in
    for half price. Here's a DTML fragment that tests for a cookie
    using the *hasVisitedZoo* variable and displays the price
    according to whether a user is new or a repeat visitor::

      <dtml-if hasVisitedZoo>
        <p>Zoo admission <dtml-var adult_rate fmt="dollars-and-cents">.</p>
      <dtml-else>
        <b>Zoo admission for first time visitors
             <dtml-var expr="adult_rate/2" fmt="dollars-and-cents"></p>
      </dtml-if>  

      % Anonymous User - Aug. 31, 2002 4:21 pm:
       Hmm. This piece of DTML contains no code to set the cookie if it's the user's first time visit, wheras the
       "equivalent" python does. How would you set a cookie in DTML ?
                                      -Liam