[Zope] Help save my sanity (DTML-in string comparison)
Darin Lee
LEEDM@state.mi.us
Mon, 18 Dec 2000 16:22:53 -0500
Zopistas,
I am trying to build a simple, 2 tier, tree-style navigation structure for my site. I have puzzled over the following code for hours, and it's just not working right. I have two loops, one that goes through the Parents, and when the parent matches the current folder, I go through the children (There are 2 scripts, one that resides one level up and presents a simple list of objects to click on) The following code lives in the child folders, and displays the parents and all of the HTML documents in the current folder.
The output I am looking for resembles below.
Item 1
Item 2
Child 1
Child 2 (<B></B> if Active document)
Child 3
Item 4
Item 5
I can generate the above output, but I would like to bold (add an arrow etc) to the "current" child object. I would also like to skip the object entirely if its ID happoens to be "index.html" This is what I can't get to work, the string compare never works!
¯---------------------------------------
<!-- Grab the current document's id>
<dtml-call "REQUEST.set('local_id',id)">
<!--had some trouble with DTML document, wanting to be it's own parent-->
<dtml-if "meta_type == 'HTML Document'">
<dtml-call "REQUEST.set('count', 2)">
<dtml-call "REQUEST.set('local_parent', PARENTS[1].id)">
<dtml-else>
<dtml-call "REQUEST.set('count', 1)">
<dtml-call "REQUEST.set('local_parent', PARENTS[0].id)">
</dtml-if>
<!-- Loop through the objects I want to show up in my nav menu ¯>
<dtml-in "PARENTS[REQUEST['count']].objectItems(['Category','Program Folder','Division Folder'])">
<!-- If the object and it's parent are the same, dump the child's contents -->
<dtml-if "id == REQUEST['local_parent']">
<a href="<dtml-var absolute_url>" CLASS="navlink"><b><dtml-var NavName></b></a><br>
<!-- Here's where it does the string compare and always fails!!!! ¯>
<dtml-in "objectItems(['HTML Document'])" >
<dtml-if "id == local_id">
I Match!<br>
<img src="pixel_clear.gif" height="1" width="10">
<A CLASS="navlink" href="<dtml-var absolute_url>"><dtml-var title_or_id><a><br>
<dtml-else>
<img src="pixel_clear.gif" height="1" width="10">
<A CLASS="navlink" href="<dtml-var absolute_url>"><dtml-var title_or_id></a><br>
</dtml-if>
</dtml-in>
<!-- If are not the same, then just put up the link ¯>
<dtml-else>
<a href="<dtml-var absolute_url>" class="navlink"><dtml-var NavName></a><br>
</dtml-if>
</dtml-in>
¯--------------------------------------------------
BTW, I have tried the NFGNav product, but It doesn't work in my application (I suspect) because I am using transparent folders to organize things. I also want my NAV to start farther down the heirarchy (level 2), not from the root.
I would appreciate any help anyone can offer!
Thanks in advance,
-Darin Lee