Typo3 单页内容渲染

Typo3 Single Page content rendering

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

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

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

这是相当标准的。此扩展程序收集所有这些页面的所有内容并将它们合并到一个页面中。我只是在获取 2 级内容时遇到问题。 这是获取所有级别 1 页面的扩展代码,但是如何为级别 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>

任何帮助将不胜感激。

添加子页面的内容适用于此 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>
        }
    }
}