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

webmaster@zope.org webmaster@zope.org
Sat, 21 Sep 2002 21:30:26 -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>
        <b>Zoo admission for first time visitors
             <dtml-var expr="adult_rate/2" fmt="dollars-and-cents"></p>

      % 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 ?

      % Anonymous User - Sep. 12, 2002 5:20 pm:
       why not
       <dtml-call "RESPONSE.setCookie('zooVisitCookie', '1')">

      % Anonymous User - Sep. 21, 2002 9:30 pm:
       /special./special offer:/
       I know its picky, my english not perfect, stumbled here.