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

Maik Roeder roeder@berg.net
Sat, 30 Sep 2000 15:28:52 +0200


Hi Sudhakar !

Sudhakar Chandra wrote:
> 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.

First you can store the your url:

<dtml-call "REQUEST.set('my_url', absolute_url())"> 

Then, when you call your method, you can test whether your
url is the current url 

<dtml-if "absolute_url()==my_url">

The must be another way of doing this, but I can't remember. Does
someone else see how this could be done differently ?
 
> 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?

You can set a REQUEST variable with the result of your computation:

<dtml-call "REQUEST.set('width', 100 / _.len(objectIds(['DTML Document','Folder'])))"> 

Regards,

Maik Röder
-- 
Uzopia - Digging la vida Zopa - http://uzopia.editthispage.com