[Zope] [Q] Generating a dynamic navigation bar...
Sudhakar Chandra
thaths@netscape.com
Mon, 02 Oct 2000 10:21:00 -0700
Maik Roeder proclaimed:
> 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 ?
Thanks. It took a bit of hackage on my part because I was calling the
subcategories DTML Method like so:
<!--#with aq_parent-->
<!--#var subcategories-->
<!--#/with-->
As you can see, I'm in a different name space inside the DTML method. I
put in the REQUEST.set in the main DTML Document instead of the DTML method
and it worked like a charm. Only pain now is that all my DTML Documents
now need to have the REQEST.set directive in them. Not a big deal.
> > 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'])))">
This worked like a charm. Thanks!
S.
--
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