[Zope] [Q] Generating a dynamic navigation bar...

Sudhakar Chandra thaths@netscape.com
Fri, 29 Sep 2000 10:41:52 -0700


Background:
I have a folder with various DTML Documents and sub-folders in it.  Sort
of like:

/foo/index_html
/foo/buy_html
/foo/really_buy_html
/foo/really_really_buy_html
/foo/bar/

I am in the process of writing a DTML method to be used from each of these
DTML documents which will generate a dynamic tabbed navigation bar for the
other DTML Documents AND sub-folders in this folder.  I am envisioning a
short table across the width of the page with cells containing links to the
other DTML documents and sub-folders.

This is what I have so far:

<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH="100%">
<TR>
<!--#in "objectItems(['DTML Document','Folder'])"-->
<!--#if "AUTHENTICATED_USER.has_permission('View',_.getitem('id',1))"-->
<!--#if "title != ''"-->
<TD BGCOLOR="#99CCCC" ALIGN=CENTER VALIGN=TOP>
<a href="<!--#var "absolute_url()"-->"><!--#var title--></a>
</TD>
<!--#/if-->
<!--#/if-->
<!--#/in-->
</TR>
</TD>
</TABLE>


Questions:

1. The problem with this DTML method is that all the DTML Documents and
Folders are represented as a link in the nav bar.  I want to build
intelligence into this DTML method to make the tab / cell for the current
document just textual (as opposed to a link).  If I am calling this method
from foo_html, I do not the "tab" for foo_html to be a link.  How do I do
this?  I'm guessing some kind of #if.

2. Currently, the TD cells of the table vary in length based on the
contents of the cell.  I want all the TDs to be of equal length.  I want to
first count the number of DTML Documents and Folders and make each TD to be
width 100/n % (where n is the number of Documents and Folders).  Any ideas
on how I can do math inside DTML methods?

Thanks.

Thaths
-- 
Lisa:  It's full, Dad, that means you have to take out the trash.
Bart:  Yup, that's the rule.  "He who tops it off, drops it off."
Homer: Nuh-uh.  "It isn't filled until it's spilled."
Sudhakar C13n    http://www.aunet.org/thaths/    Lead Indentured Slave