Typo3 8.7 Typoscript: Navbar with HMENU: exclude hierarchical step from displaying

87 views Asked by At

I'm currently working on my navbar in Typo3 Typoscript. My project page structur goes as follows:

root
 1
 1
 1
  2
   3
   3
 1
 1
  2
   3
   3

What I want now is to exclude the 2's (kick them), but keep displaying all 3's when selecting the 1's that have 3's as their children.

Like this:

   root
     1
     1
     1
      3
      3
     1
     1
      3
      3

My code in TypoScript that displays the complete page structure

NAVIOFF = HMENU
    NAVIOFF.entryLevel = 0
    NAVIOFF {
    1 = TMENU
    1 {
    expAll = 1
    wrap = <ul class="sf-menu">|</ul>
    noBlur = 1
    NO = 1
    NO.ATagTitle.field = title
    NO.wrapItemAndSub = <li>|</li>
    IFSUB = 1
    IFSUB < .NO
    IFSUB.ATagParams = class="pfeile"  

     ACT = 1
     ACT < .NO
     ACT.ATagParams = class="menuakt"
     CUR = 1
     CUR < .ACT

    }
    2 < .1  
    2.wrap = <ul>|</ul>
    2.NO.wrapItemAndSub =  <li class="first"> |</li> |*| <li> |</li> |*| <li class="last"> | </li>   
    2.ACT = 0

    3 < .2
    4 < .2
    }

Is it possible to achieve what I want? So far I stumbled across excludeUIDlist but then I obviously kick the complete 2's and the 3's "attached" to them.

Thanks in advance.

2

There are 2 answers

1
Bernd Wilke πφ On

just skip the 2nd level in menu:

do nothing with the 2nd level:

//remove:
# 2 < .1
// no rendering:
2.NO.doNotShowLink = 1

of course you can not copy .2. For further levels you start with .3 adapt it and then copy level 3:

3 < .1  
3.wrap = <ul>|</ul>
3.NO.wrapItemAndSub =  <li class="first"> |</li> |*| <li> |</li> |*| <li class="last"> | </li>   
3.ACT = 0

4 < .3
0
NextThursday On

You can override the rendering of the 2. level, like "every second level should just output empty string and no linking", e.g. using

    2.NO.stdWrap.override =  |*| |*|
    2.NO.doNotLinkIt = 1

Than, instead of having a output of [element 2[element3a],[element3b]] you should get [nothing[element3a],[element3b]], which seems to be what you want.