[TYPO3-UG US] Menu Question

K from DC kfromdc at gmail.com
Sun Nov 5 01:10:50 CET 2006


Thanks Christopher,

Thanks to your code suggestion I now have a working menu with a current
state.

Here's what you suggested:
lib.menu = HMENU
lib.menu {
        1 = TMENU
        1 {
                wrap = <ul id="nav">|</ul>
                noBlur = 1

                NO = 1
                NO {
                        wrapItemAndSub = <li>|</li>
                }

                ACT = 1
                ACT {
                        wrapItemAndSub = <li class="current">|</li>
                }

                ACTIFSUB = 1
                ACTIFSUB {
                        wrapItemAndSub = <li class="current parent">|</li>
                }
        }

        2 < .1
        2.wrap = <ul>|</ul>
        3 < .2
        4 < .2
}

And here's what I ended up with:

temp.rmenu = COA
temp.rmenu {
       10 = HMENU
       10.special = directory
       10.special.value = 1636
       10.1 = TMENU
       10.1 {
               wrap = <div  id="menur"><ul>|</ul></div>
               noBlur = 1

               NO = 1
               NO {
                      ATagParams = class="no"
                      wrapItemAndSub = <li>|</li>
               }

               ACT = 1
               ACT {
                       ATagParams = class="cur"
                       wrapItemAndSub = <li>|</li>
               }

               ACTIFSUB = 1
               ACTIFSUB {
                       ATagParams = class="act"
                       wrapItemAndSub = <li>|</li>
               }
       }

       10.2 < .10.1
       10.2.wrap = <ul>|</ul>
       10.3 < .10.2
       10.4 < .10.2
}

However, the menu is not quite where I'd like it to be, yet. If I click on a
page link and the page doesn't have subpages, the link gets style "cur,"
which is great. But, if the page does have subpages the menu just unfolds to
show the next level of pages, and the current page get's style "act." Here's
the markup:

<div id="menur">
    <ul>
        <li>
           <a class="act" href="#"> // this is the page link I've just
clicked on
              Page 1
          </a>
          <ul>
             <li>
                <a class="no" href="#">
                    Page1.1
                </a>
             </li>
             <li>
                <a class="no" href="#">
                    Page1.2
                </a>
             </li>
          </ul>
        </li>
        <li>
           <a class="act" href="#">
              Page 2
          </a>
       </li>
    </ul>
</div>

What I'm trying to achieve is:

<div id="menur">
    <ul>
        <li>
           <a class="cur" href="#"> // this is the page link I've just
clicked on
              Page 1
          </a>
          <ul>
             <li>
                <a class="no" href="#">
                    Page1.1
                </a>
             </li>
             <li>
                <a class="no" href="#">
                    Page1.2
                </a>
             </li>
          </ul>
        </li>
        <li>
           <a class="act" href="#">
              Page 2
          </a>
       </li>
    </ul>
</div>


This to me sounds like:

if (ACT) {
    class = "cur"
}
else if (ACTIFSUB) {
     if (ACT) {
        class="cur"
     }
     esle {
         class="act"
     }
}
else {
     class = "cur"
}

I have no idea how to implement this in TS and I remember reading somewhere
that you can't do conditionals between {...} in TS.

Anyways, thanks for all your help so far. Look forward to hearing from you,
LB



More information about the TYPO3-UG-US mailing list