[Zope] snippets (was RE: [Zope] Where do I find out about cookies?)

Jean Jordaan Jean@mosaicsoftware.com
Mon, 28 Aug 2000 12:53:29 +0200


Hi RDM 

Thanks! That works perfectly, and teaches me about namespaces. 
I just had to fix '</dtml-else>' (I also do that)::

  <dtml-if sort_key>
    <dtml-if "REQUEST.form.has_key('sort_key')">
      <dtml-call "RESPONSE.setCookie('sort_key',REQUEST.form['sort_key'])">
    </dtml-if>
  <dtml-else>
    <dtml-call "REQUEST.set('sort_key','title')">
    <dtml-call "RESPONSE.setCookie('sort_key','title')">
  </dtml-if>

Here's a shortened version of my own, from Squishdot. Instead
of this::

  <dtml-if "reply_cnt > 1">
    <B>(<dtml-var reply_cnt> comments<dtml-if body_len>, 
    <dtml-var body_len> in body</dtml-if>)</B>
  <dtml-elif reply_cnt> 
    <B>(<dtml-var reply_cnt> comment<dtml-if body_len>, 
    <dtml-var body_len> in body</dtml-if>)</B>  
  <dtml-else> 
    <dtml-if body_len>
      <B>(<dtml-var body_len> in body)</B>
    </dtml-if> 
  </dtml-if>

I made this::

  <dtml-if body_len>
    <b>(<dtml-if reply_cnt><dtml-var reply_cnt> 
    comment<dtml-if "reply_cnt > 1">s</dtml-if>,
    </dtml-if><dtml-var body_len> in body)</b>
  </dtml-if body_len>

-- 
Jean Jordaan       --    technical writer    --
Mosaic Software    --    Zope 2.1.6 on WinNT and W2K