[Zope] Radio button effect for links - thanks!
Wed, 18 Jul 2001 06:50 -0700
I'd like to hear more about that myself, from the dtml/python gurus. I never get tired of reading the simple explanations for these enigmatic constructs. But then they ruin it by pointing out that there are five other ways to get the same thing--then I'm lost again. :)
But I know that _ is the namespace, everything that is to be had is inside there, including form, querystring and envirnment vars.
And using [] is a way (I think) of saying return the text of the id rather than the object it represents.
But I stand corrected in advance for probably being wrong or too narrow in this explanation.
Richard
> Worked a treat, thanks.
>
> Could someone explain what _[ ] means?
>
> Also, this would be great if it could be factored out into a python
> script and used all over the site. I tried the following:
>
> Root
> standard_html_header
> toggleLinkScript
> FolderA
> index_html
> nav
>
> 'index_html' has a reference to 'standard_html_header'.
> 'standard_html_header' has a reference to 'nav'. 'nav' has a
> reference to 'toggleLinkScript'.
>
> toggleLinkScript:
> return context.getid() <--- this returrns FolderA, which makes
> sense, but is not what I want.
>
> Is there a way that 'toggleLinkScript' can be called from 'nav' and
> return the id of 'index_html'? This would make the script genereic
> and be used all over the site.
>
> Hope this makes sense. Thanks again.
>
> Sion
>
>
> >Try it like this:
> >
> ><dtml-if "_['id']=='index_html'">
> >
> >> ------------ Original Message -----------
> >> From: Sion Morris <s.morris@bangor.ac.uk>
> >> Date: Tue, 17 Jul 2001 20:46:22 +0100
> >>
> >> Hi,
> >>
> >> Can someone please help me with what I thought would be a simple
> problem;
> >>
> >> I would like a series of links in a nav bar to behave like radio
> >> buttons. When a page is selected the link to that page in the nav bar
> >> is deactivated and is displayed as normal text.
> >>
> >> I have tried the following in a DTML Method called 'nav'.
> >>
> >> <dtml-var id>
> >> <dtml-if expr="id='index_html'"> ## index_html is a DTML Document
> >> <dtml-var nav>
> >> <b>index page</b>
> >> <dtml-else>
> >> <a href="index_html">
> >> </dtml-if>
> >>
> >> Even though <dtml-var id> displays the document id as 'index_html' it
> >> still shows the link instead of the bolded text.
> >>
> >> Has anyone done this in the past and is willing to share their wisdom.
> >>
> >> Thanks,
> >>
> >> Sion
> >>
> >> _______________________________________________
> >> Zope maillist - Zope@zope.org
> >> http://lists.zope.org/mailman/listinfo/zope
> >> ** No cross posts or HTML encoding! **
> >> (Related lists -
> >> http://lists.zope.org/mailman/listinfo/zope-announce
> >> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>
> --
> Computer Support
> Sion Morris
> School of Psychology Ysgol Seicoleg
> University of Wales, Bangor Prifysgol Cymru Bangor
> Tel: 01248 382469
> Fax: 01248 382599
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )