TYPO3选择所有页面的下拉列表(1级和2级)

时间:2012-07-10 07:26:28

标签: select typo3 typoscript

我目前正在努力处理typoscript。我需要存档的是选择框,其中包含特定页面的所有页面(级别1,级别2)。

所以,我们假设我有一个名为“Products”的页面,它有子项“Product 1”和“Product 2”。 “产品1”和“产品2”都有自己的其他子项。

现在,我得到了以下脚本:

temp.drop_down_box = COA
temp.drop_down_box {
  10 = HMENU
  10 {
     # Special menu type 'directory': Get subpages of the current page
     special = directory
     # '123' is the uid of the page, for which the subpages shall be listed in the drop down box
     special.value = 35
     # Select box with JavaScript event 'onChange' that enables a jump to the target page, once an entry has been selected in the list
     wrap = <select name="dropdown_navigation" size="1" onChange="document.location.href='index.php?id=' + this.value">|</select>
     1 = TMENU
     1 {
       expAll = 1
       noBlur = 1
       NO {
         # 'value' holds the uid of the page in the list (is later appended to the target URL above)
         stdWrap.dataWrap = <option value="{field:uid}">
         allWrap = |</option>
         # Don't wrap the items in link tags
         doNotLinkIt = 1
       }
       # Inherit the 'allWrap' and 'doNotLinkIt' settings from the NO part
       CUR < copy">.NO
       CUR = 1
       CUR {
       # If we're on the current page, mark this list entry as 'selected'
         stdWrap.dataWrap = <option value="{field:uid}" selected="selected">
       }
     }
  }
}

它工作得很好,但只在一个层面上。我想这样做:

Product
- Product 1
  - Item 1
  - Item 2
  - Item 3
  - Item 4
- Product 2
  - Item 1
  - Item 2
  - Item 3

......等等。

有没有办法做到这一点?

祝你好运, 安德烈亚斯

*编辑:搞定了:

temp.drop_down_box = COA
temp.drop_down_box {
  10 = HMENU
  10 {

    // ... {code from first part of question here} ...
    // additional levels copying 1 level and changing required values

    2 < .1
    2.NO.linkWrap = <option value="{field:uid}">-- |</option>

    3 < .1
    3.NO.linkWrap = <option value="{field:uid}">---- |</option>

  }
}

1 个答案:

答案 0 :(得分:2)

对于每个菜单级别,您需要添加下一个TMENU声明:

1 = TMENU
1 {
   ...
}

2 = TMENU
2 {
   ...
}

99 = TMENU
99 {
   ...
}