TYPO3 typoscript菜单:隐藏元素条件

时间:2017-07-03 06:26:54

标签: typo3

这是我的typoscript菜单:

page.10.variables {
menue = HMENU
menue {
#special = directory
#special.value = 17
wrap = <div id="mobile-header"><div class="bar"></div></div><div class="menu-collapsed"><div id="navigation"><nav class="nav"><ul>|</ul></nav></div></div>
1 = TMENU
1.expAll=1
1 {
      NO {
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
        # linkWrap = |<span class="underline"></span>
         ATagParams=class="navi"
          }
      RO = 1
      RO {         
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
        # linkWrap = |<span class="underline"></span>   
         ATagParams=class="navi"
         }
      ACT = 1
      ACT {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
        # linkWrap = |<span class="underline"></span>
        ATagParams=class="navi_active"
        }  

       IFSUB = 1
       IFSUB {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
         linkWrap = |<i class="fa fa-angle-down" aria-hidden="true"></i>
         ATagParams=class="navi sub"
            }

     ACTIFSUB < .IFSUB

        SPC = 1
    SPC {
     doNotLinkIt = 1
     doNotShowLink = 1
     allWrap = <div class="space"></div>
    }    
  }

  2 < .1
  2.wrap = <ul class="nav_list1 subnavi resp">|</ul>
  2.NO.wrapItemAndSub = <li> |</li>
  2.ACT.wrapItemAndSub = <li> |</li>
  3 < .2
  3.wrap = <ul id="subsubnavi">|</ul>
  }


menue2 = HMENU
menue2 {
special = directory
special.value = 62
1 = TMENU
1.expAll=1
1 {
wrap = <div class="box-menue2"><nav class="nav"><ul class="profile_tab">|</ul></nav></div>
      NO {
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
         ATagParams=class="navi2"
     stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
          }
      RO = 1
      RO {         
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
        stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
         ATagParams=class="navi2"
         }
      ACT = 1
      ACT {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
     stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
        ATagParams=class="navi2_active"
        }  

       IFSUB = 1
       IFSUB {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
         linkWrap = |<i class="fa fa-angle-down" aria-hidden="true"></i>
         ATagParams=class="navi2 sub"
            }

     ACTIFSUB < .IFSUB

        SPC = 1
    SPC {
     doNotLinkIt = 1
     doNotShowLink = 1
     allWrap = <div class="space"></div>
    }    
  }

  2 < .1
  2.wrap = <ul class="nav_list">|</ul>
  2.NO.wrapItemAndSub = <li> |</li>
  2.ACT.wrapItemAndSub = <li> |</li>
  3 < .2
  3.wrap = <ul id="subsubnavi">|</ul>
  }


menue3 = HMENU
menue3 {
special = directory
special.value = 57
1 = TMENU
1.expAll=1
1 {
wrap = <div class="box-menue3"><nav class="nav3"><ul class="profile_tab">|</ul></nav></div>
      NO {
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
         ATagParams=class="navi2"
     stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
          }
      RO = 1
      RO {         
         wrapItemAndSub = <li>|</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
        stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
         ATagParams=class="navi2"
         }
      ACT = 1
      ACT {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
     stdWrap.dataWrap =<i class="fa fa-{field:tx_iconfont_icon}" aria-hidden="true"></i>
     stdWrap.dataWrap.insertData=1
        ATagParams=class="navi2_active"
        }  

       IFSUB = 1
       IFSUB {
         wrapItemAndSub = <li> |</li>
         stdWrap.cObject = TEXT
         stdWrap.cObject.field = subtitle // title
         ATagBeforeWrap = 1
         linkWrap = |
         ATagParams=class="navi sub"
            }

     ACTIFSUB < .IFSUB

        SPC = 1
    SPC {
     doNotLinkIt = 1
     doNotShowLink = 1
     allWrap = <div class="space"></div>
    }    
  }

  2 < .1
  2.wrap = <ul class="nav_list">|</ul>
  2.NO.wrapItemAndSub = <li> |</li>
  2.ACT.wrapItemAndSub = <li> |</li>
  3 < .2
  3.wrap = <ul id="subsubnavi">|</ul>
  }

    FOO2 = HMENU
    FOO2{
   special = directory
   special.value = 18  
   1 = TMENU
   1 {
         NO {   
      wrapItemAndSub = | |*| &nbsp;&nbsp; | |*| &nbsp;&nbsp; |
         }
   }
   }
}

我需要在条件菜单上显示一些子元素。如果db == 0中的某个字段:显示一个菜单元素,则:显示第二个。可能吗 ?我希望你明白我的意思。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

'条件'在typoscript方面并不是唯一的。

有'条件'可以打开和关闭部分打字错误。

[global]

这些条件通常取决于页面调用的环境。

您需要一个取决于数据库值的条件,因此您需要使用stdWrap函数来评估数据值 除了具有多个选项的大函数if之外,还有overrideifEmptyifBlank

您可以在COA中编写备选方案并使用自己的if包装每个部分,或者使用默认配置编写您的typoscript并执行override已打开并使用其自己的{ {1}}换行。

对于干净的typoscript,您可以使用if个对象,您可以复制并保持使用清洁 示例:

temp