Typo3单页内容呈现

时间:2016-01-14 22:34:08

标签: typoscript typo3-6.2.x

我尝试使用t3onepage扩展程序稍加修改,但似乎无法使其正常工作。该扩展程序仅适用于单级后端页面结构,但我也希望能够添加子页面。

在后端,我希望有一个干净易用的页面结构,如下所示:

  Level 1
    Level 2
    Level 2
  Level 1
  Level 1
    Level 2

这是非常标准的。此扩展程序收集所有这些页面的所有内容,并将它们合并到一个页面中。我在获取2级内容时遇到问题。 这是获取所有Level 1页面的扩展代码,但是如何为Level 2执行此操作?

20 = CONTENT
20 {
    table = pages
    select.orderBy = sorting

    renderObj = COA
    renderObj {
        10 = CONTENT
        10 {
            table = tt_content
            select {
                pidInList.field = uid
                orderBy = sorting
                where = colPos = 0
            }

            wrap = <section id="{field:css_id}" class="{field:css_class}">|</section>
            wrap.insertData = 1
        }
    }

    wrap = <main role="main">|</main>
}

生成的html代码如下所示:

<section ids, etc>Level 1</section>
<section ids, etc>Level 1</section>
<section ids, etc>Level 1</section>

我喜欢它有类似的东西:

<section ids, etc>Level 1</section>
<section ids, etc>Level 2</section>
<section ids, etc>Level 2</section>
<section ids, etc>Level 1</section>
<section ids, etc>Level 1</section>
<section ids, etc>Level 2</section>

任何帮助都将非常感激。

1 个答案:

答案 0 :(得分:0)

添加子页面的内容适用于此TypoScript。您需要在第一个renderObj中放置另一个CONTENT。

lib.onepage {
   20 = CONTENT
   20 {
      table = pages
      select.orderBy = sorting
      renderObj = COA
      renderObj {
         10 = CONTENT
         10 {
            table = tt_content
            select {
               pidInList.field = uid
               orderBy = sorting
               where = colPos = 0
            }
            wrap = <section id="{field:css_id}" class="{field:css_class}">|</section>
            wrap.insertData = 1
         }
         20 = CONTENT
         20 {
            table = pages
            select {
               orderBy = sorting
               pidInList.field = uid
            }
            renderObj = COA
            renderObj {
               10 = CONTENT
               10 {
                  table = tt_content
                  select {
                     pidInList.field = uid
                     orderBy = sorting
                     where = colPos = 0
                  }
                  wrap = <section id="{field:css_id}" class="{field:css_class}">|</section>
                  wrap.insertData = 1
               }
           }
           wrap = <main role="main">|</main>
        }
    }
}