如何在Typoscript中呈现此类别页面菜单的子页面?

时间:2014-04-30 14:24:35

标签: typo3 typoscript

我有一个像这样的页面结构:

- About us (lvl 1)
  -- About us 1 (lvl 2)
  -- About us 2 (lvl 2)
  -- About us 3 (lvl 2)
     --- Detail about us 3 (lvl 3)
     --- Detail about us 3 (lvl 3)
  -- About us 4 (lvl 2)
- Our great products (lvl 1)
  -- Great products (lvl2)
   --- Detail great products (lvl 3)

每个lvl 2页面都有一个右侧菜单,显示所有其他lvl2页面具有相同的lvl1父级。用Typoscript渲染它:

 lib.side_buttons_submenu = CONTENT
 lib.side_buttons_submenu {
   table = pages
   select {
     orderBy = sorting
         recursive = 0
         selectFields = uid, subtitle
   }
   renderObj  = TEXT
   renderObj  {
     field = subtitle
     required = 1
     typolink.parameter.field = uid
     wrap = <li>|</li>
   }
   wrap = |
 }

输出:

  <ul class="side_buttons">
   <li>About us 1</li>
   <li>About us 2</li>
   <li>About us 3</li>
   <li>About us 4</li>
  </ul>

我想在lvl 2页面下添加lvl3页面,如果页面有子页面,则添加class =“parent”,因此侧边菜单如下所示:

 <ul class="side_buttons">
   <li>About us 1</li>
   <li>About us 2</li>
   <li class="parent">About us 3
       <ul> 
           <li>Detail about us 3</li>
           <li>Detail about us 3</li>
       </ul>
   </li>
   <li>About us 4</li>
</ul>

我在Typoscript文档中的任何地方都找不到这样的例子 - 有没有人有一个片段告诉我该怎么做?

1 个答案:

答案 0 :(得分:0)

the answers to this question的帮助下,我终于明白了!这将在带有子页面的lvl2项目上呈现带有“父”类的lvl2 + lvl3菜单:

lib.side_buttons_submenu = HMENU
lib.side_buttons_submenu {

entryLevel = 1

1 = TMENU
1 {

    expAll = 1

    NO.field = subtitle
    NO.required = 1
    NO.typolink.parameter.field = uid
    NO.linkWrap = <li>|</li>

    IFSUB = 1
    IFSUB.wrapItemAndSub= <li class="parent">|</li>

    ACTIFSUB < .IFSUB
    CURIFSUB < .IFSUB

    ACT < .NO
    ACT = 1
    ACT.linkWrap = <li class="current">|</li>

}

2 = TMENU
2 {
    wrap = <ul>|</ul>
    NO = 1
    NO.wrapItemAndSub = <li>|</li>
}
}