How to use option split to control typo3 menu properties?

后端 未结 2 1384
礼貌的吻别
礼貌的吻别 2021-01-16 00:15

I am trying to resolve a design issue implementation in typo3. Essentially I have to implement a tabbed menu (only the active state is tabbed) that\'s generated from the dir

相关标签:
2条回答
  • 2021-01-16 00:27

    If your problem is that you want to wrap different sub-menues on the same level with different class attributes, then have a look at the submenuObjSuffixes property of the TMENU object.

    While it is not possible to use optionsplit with wrap (simply because wrap is only executed once) it is very well possible to get the desired result using submenuObjSuffixes.

    Here is an example:

    1 = TMENU
    1 {
        wrap = <ul>|</ul>
        submenuObjSuffixes =  |*| b |*| c
    
        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
        }
    }
    
    2 < .1
    2.wrap = <ul class="firstItem">|</ul>
    2b < .1
    2b.wrap = <ul class="middleItems">|</ul>
    2c < .1
    2c.wrap = <ul class="lastItem">|</ul>
    
    3 < .2
    3b < .2b
    3c < .2c
    4 < .2
    4b < .2b
    4c < .2c
    

    This will wrap the first 2nd-level menu with class "firstItem", the last 2nd-level menu with "lastItem" and all inbetweens with class "middleItems".

    Please understand that the suffixes are appended to ALL subsequent menu levels. So if you use submenuObjSuffixes on level 1 it will not only affect level 2 but also levels 3, 4, ... and you have to define corresponding options on these levels too, or they will not be rendered.

    0 讨论(0)
  • 2021-01-16 00:40

    I do not think a new site should use GMENU any more. Instead you should use TMENU with CSS.

    Here is a basic example that should get you started:

    10 = HMENU
    10 {
      special = directory
        # start with pid 3
      special.value = 3
      1 = TMENU
      1 {
        expAll = 1
        wrap = <ul>|</ul>
        NO = 1
        NO {
          wrapItemAndSub = <li>|</li>
          ATagTitle = abstract // description // title
        }
        ACT < .NO
        ACT.wrapItemAndSub = <li class="active">|</li>
        CUR < .NO
        CUR.wrapItemAndSub = <li class="current">|</li>
      }
      2 < .1
      3 < .1
      4 < .1
      4.wrap = <ul class="level-4">|</li>
    }
    

    Of course you can now use option split for wrapItemAndSub like so: wrapItemAndSub = <li class="first">|</li> |*| <li class="normal">|</li> |*| <li class="last">|</li>

    The rest in then just normal CSS.

    0 讨论(0)
提交回复
热议问题