TYPO3 - TypoScript添加链接参数

时间:2014-12-12 13:33:11

标签: typo3 typoscript

是否可以仅向第一个菜单项(menu-itemfirst)添加额外的链接参数

item1
<div class="menu-itemfirst">
<a onfocus="blurLink(this);" href="planner/">planner</a></div>
item2
<div class="menu-item">
<a onfocus="blurLink(this);" href="concept/">Concept</a>
</div>
etc….

看起来应该是这样......

item1
<div class="menu-itemfirst">
<a onfocus="blurLink(this);" href=„int/kdb/eng/planner/">planner</a></div>
item2
<div class="menu-item">
<a onfocus="blurLink(this);" href="concept/">Concept</a>
</div>
etc….

添加参数:int / kdb(静态)和eng(动态,语言键)

我的TS:

lib.mainNavigation = HMENU
    lib.mainNavigation {
      special = 
      excludeUidList = 
      1 = TMENU
      1 {

        noBlur = 0
        NO {
          allWrap = <div class="menu-itemfirst"> | </div><div class="menuline"></div> || <div class="menu-item"> | </div><div class="menuline"></div> || <div class="menu-item"> | </div><div class="menuline"></div>
          stdWrap.htmlSpecialChars = 1
        }

        ACT = 1
        ACT {

            allWrap = <div class="menu-itemfirst-act" style="padding-left:0;"> | </div><div class="menuline"></div> || <div class="menu-item-act"> | </div><div class="menuline"></div> || <div class="menu-item-act"> | </div><div class="menuline"></div>
          stdWrap.htmlSpecialChars = 1
       }    


        }

    }

1 个答案:

答案 0 :(得分:0)

您可以将菜单拆分为两部分,然后使用 COA 。例如。像这样的东西:

lib.mainNavigation = COA
lib.mainNavigation.10 = HMENU
lib.mainNavigation.10 {
  1 = TMENU
  1 {
    maxItems = 1
    NO {
      allWrap = <div class="menu-itemfirst"> | </div><div class="menuline"></div>
      stdWrap.htmlSpecialChars = 1
      doNotLinkIt = 1
      stdWrap.wrap = <a onfocus="blurLink(this);" href="int/kdb/{$config.language}/planner/">|</a>
    }

    ACT = 1
    ACT < .NO
    ACT.allWrap = <div class="menu-itemfirst-act" style="padding-left:0;"> | </div><div class="menuline"></div>
  }
}

lib.mainNavigation.20 = HMENU
lib.mainNavigation.20 {
  1 = TMENU
  1 {
    noBlur = 0
    begin = 2
    NO {
      allWrap = <div class="menu-item"> | </div><div class="menuline"></div>
      stdWrap.htmlSpecialChars = 1
    }

    ACT = 1
    ACT < .NO
    ACT.allWrap = <div class="menu-item-act"> | </div><div class="menuline"></div>
  }
}

请注意,您需要拥有名称 config.language 常量,这与您的语言映射和语言TS consitions中的更改相对应。当然,您可以将名称更改为更合适,但不要忘记在菜单的TS中更改名称。

此外,我没有测试此代码,但你应该知道,该怎么做。