2014-09-26 62 views
1

如果當前活動菜單項具有子菜單(ACTIFSUB),我想更改TMENUwrap當活動菜單項具有子菜單時更改TMENU的包裝

下面是我的Typo腳本的摘錄:

lib.navigation = HMENU 
lib.navigation { 

1 = TMENU 
1 { 

    wrap = <ul class="m-navigation-list">|</ul> 

    # if the current active menu item has a submenu, change the wrap to this: 
    # wrap = <ul class="m-navigation-list m-navigation-list--parent">|</ul> 

    ACTIFSUB = 1 
    ACTIFSUB { 
     wrapItemAndSub = <li class="m-navigation-item m-navigation-link--parent m-navigation-link--ladder">|</li> 

     # overwrite the wrap of the TMENU? 
    } 

} 

回答

2

,如果你能expAll要小心,子菜單會始終打印和後果倍率始終使用。

這裏是工作示例:

lib.navigation = HMENU 
lib.navigation { 
    wrap = <ul>|</ul> 
    wrap.override = <ul class="override">|</ul> 
    entryLevel = 0 
    1 = TMENU 
    1 { 
     expAll = 0 
     NO.allWrap = <li> | </li> 
     ACT = 1 
     ACT.allWrap = <li>|</li> 
     ACTIFSUB = 1 
     ACTIFSUB { 
      allWrap= <li class="sub">|</li> 
      before.cObject = LOAD_REGISTER 
      before.cObject.actsubmenu = TEXT 
      before.cObject.actsubmenu.value = 1 
     } 
    } 
    wrap.override.if.isTrue.data = REGISTER:actsubmenu 
} 
+0

哇,太神奇了!謝謝! '註冊'的東西訣竅!我有一個問題,但我的活動菜單點會('ACTIFSUB')不打印鏈接文本。但我可以通過使用'before.cObject = LOAD_REGISTER'來解決它,就像在這個問題中一樣:http://stackoverflow.com/q/17569034/723769 – Jona 2014-09-30 08:28:20

+1

對,我沒有測試,並沒有想到該cObject會覆蓋默認文本..我會更新上面的代碼 – 2014-09-30 11:55:53