[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Nested navbars



Hello Fritz Zaucker, in a previous mail you wrote:

> Hmmm, this looks pretty good!
> 
> However (as always, there is one more feature missing ...):
> 
> If you look at http://ee-staff.ethz.ch/~zaucker/test/ and there select
> the link "Aktuelles" and below that "Präsident" you will see that you
> can't jump back to "Aktuelles" (this should be clearer if you look at
> the pages).
> 
> This is because I could not figure out how to make the link active in
> the main bar.
> 
> Note, this must be an option, not hard wired, as there are also pages
> that don't have a sub navbar and there it obviously makes sense to
> deactivate the link.
> 
> Any solution for that?

Sure, for this case wml::des::navbar provides the `subselected' feature.  I've
uses it now according to the value the include parameter `subarea'.  If
subarea is set to "none" this means no subarea is selected and thus leading to
all subareas surrounded with hyperlinks but the main area rendered without a
hyperlink (because when no subarea is selected this implies that the main area
is selected). But when subarea is not "none" then this means a subarea is
selected and this the subarea is rendered without the hyperlink and the main
area now gets a hyperlink. Voala!

Here is the updated navbar2.inc file:

==========================
##
##  navbar2.inc -- support nested navbar with two levels
##  Copyright (c) 1998 Ralf S. Engelschall, All Rights Reserved. 
##

#   we are based on the original navbar tags
#use wml::des::navbar
#use wml::des::space

#   the container tag for definition of the
#   main navbar or a sub navbar
<define-container nb:define>
<ifeq "%0" "main" <prog
    <navbar:define name="main">
      <navbar:header>
        <table cellspacing=0 cellpadding=0 border=0>
        <<FILLER>>
      </navbar:header>
      <navbar:prolog>
        <tr><td><b>
      </navbar:prolog>
      %body
      <navbar:epilog type=S>
        </b>
        #   HERE IS THE NESTING!
        <<SNB>>
        </td></tr>
      </navbar:epilog>
      <navbar:epilog type=SS>
        </b>
        #   HERE IS THE NESTING!
        <<SNB>>
        </td></tr>
      </navbar:epilog>
      <navbar:epilog>
        </b></td></tr>
      </navbar:epilog>
      <navbar:footer>
        </table>
      </navbar:footer>
    </navbar:define>
> <prog
    <navbar:define name="%1">
      <navbar:header>
        <table cellspacing=0 cellpadding=0 border=0>
        <tr>
        <td>
        &nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td>
        <table cellspacing=0 cellpadding=0 border=0>
      </navbar:header>
      <navbar:prolog>
        <tr><td>
      </navbar:prolog>
      %body
      <navbar:epilog>
        </td></tr>
      </navbar:epilog>
      <navbar:footer>
        </table>
        </td>
        </tr>
        </table>
      </navbar:footer>
    </navbar:define>
>>
</define-container>

#   the filler has to be coded separately to avoid
#   pass conflicts (sorry)
..FILLER>><space width=200><<..

#   the tag for defining a particular button
<define-tag nb:button>
<navbar:button id="%0" txt="%1" url="%2">
</define-tag>

#   and finally the nested rendering
<define-tag nb:render>
<navbar:render name=main select=%0 <ifeq "%1" "none" "" "subselected">>
..SNB>>
<navbar:render name=%0 select=%1 <ifeq "%1" "none" "subselected">>
<<..
</define-tag>
==========================

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com