[Zope] string comparison question

Phil Harris phil.harris@zope.co.uk
Fri, 25 Feb 2000 00:52:27 -0000


Rowan,

Try something like:

     <dtml-in "getChildNodes()">
       <dtml-let ntype="getNodeName()">
          <dtml-if  "_.string.find(ntype,'BLOCKQUOTE')" >
             <i>print something</i>
           </dtml-if>
        </dtml-let>
      </dtml-in>

btw if your newish to Zope you should get hold of the Zope Quick Reference
from http://yyy.zope.org/Members/ZQR.

HTH

phil
phil.harris@zope.co.uk

----- Original Message -----
From: Rowan Hick
To: zope@zope.org
Sent: 25 February 2000 00:45
Subject: [Zope] string comparison question


This is probably really dumb, but I can't figure out how to do the
following:

Compare the ntype variable in the following code with a straight boring old
string eg "BLOCKQUOTE"

eg if nytpe = blockquote, then print text_content() in italics..

     <dtml-in "getChildNodes()">
       <dtml-let ntype="getNodeName()">
          <dtml-if  ...condition..... >
             print something
           </dtml-if>
        </dtml-let>
      </dtml-in>

I've looked through the DTML help file but it's confused me more than
anything else, I'm guessing I need to use the
find(S, SUB[, START])    syntax as part of the string module
But I can't figure it out.. there's no examples in the help of string
comparison functions and what this _ business is all about, I'm sure after I
see an example it will all become quite clear, but for the life of me I just
can't get it sorted..
Helllllpppppp!!!!

Rowan Hick
Business Analyst,
Soft Tech NZ LTD
www.softtechnz.com