[Zope] dtml-if syntax and comparing variables

Roché Compaan roche@up-front.co.za
Sun, 7 Nov 1999 10:26:55 +0200


I have a method in my root folder that draws a top navigation bar by looping
through the subfolders.  I don't want to publish links to all the subfolders
however and prevent subfolders from being listed by checking if a folder has
a property called "index_me".  I also don't want to make a link active if am
currently in that folder.  I have a few questions after battling with syntax
for about 3 hours:

1.What is the simplest way to do what i've done? (see code below)
2.What is the simplest way to check if the folder being queried in
objectValues is equal to the  URL in the Request variable?

#Here I first check to see if i am in the root folder.
#If I am I just emphasize the text, other wise a create a link to the
homepage.
#I also just use objectValues('Folder') to make the links if I am at the
homepage and
#I use PARENTS[1].objectValues('Folder') to make links if I am not

<dtml-with REQUEST>
<dtml-if "URL0==BASE2">
  <em>Afrimusik Homepage</em>

<dtml-in "objectValues('Folder')">
  <dtml-if "hasProperty('index_me')">
    | <a href="<dtml-var absolute_url>"><dtml-var title></a>
  </dtml-if>
</dtml-in>|]

<dtml-else>
  <a href="<dtml-var SCRIPT_NAME>">Afrimusik Homepage</a>

<dtml-in "PARENTS[1].objectValues('Folder')">
  <dtml-if "hasProperty('index_me')">

#This is where I am stuck.  I simply want to compare the URL in the Request
variable to
#absolute_url of the folder being queried.  <dtml-if "URL==absolute_url">
does not work.

    <dtml-if "URL==absolute_url">
      | <em><dtml-var title></em>
    <dtml-else>
      | <a href="<dtml-var absolute_url>"><dtml-var title></a>
    </dtml-if>
  </dtml-if>
</dtml-in>|]

</dtml-if>
</dtml-with>

Thanks
Roché Compaan