Typo3 单页包含带有自己模板的子页面

Typo3 onepage include subpages with their own templates

我有一个单页布局的 Typo3 网站。该网站有几个部分(新闻、投资组合、幻灯片……)。每个部分都有自己特定的 layout/template。在 Typo3 中,我将这些部分作为带有自己模板的子页面。教程中的以下代码以正确的顺序为我提供了该子页面的内容。

lib.sectionContent {
  1 = TMENU
  1 {
    NO = 1
    NO {
      doNotLinkIt = 1
      stdWrap >
      stdWrap {
        cObject = COA
        cObject {
          if.value = 5
          if.equals.field = doktype
          if.negate = 1
          10 < temp.titleSectionId
          10.wrap = <section id="|" class="page-section" style="margin-top: 30px;">
          20 = CONTENT
          20 {
            table = tt_content
            select {
              pidInList.field = uid
            }
            renderObj < tt_content
          }
          30 = TEXT
          30 {
            wrap = </section>
          }
        }
      }
    }
  }
}

但是我也需要用过的模板。我需要一种方法将子页面及其模板集成到 parent-page/onepage-website.

您需要使用该页面的内容而不是仅使用内容来呈现模板。

所以你的 20 应该是这样的模板对象:

20 = FLUIDTEMPLATE
20 {
    file.cObject = CASE
    file.cObject {
        key.field = backend_layout

        1 = TEXT
        1.value = fileadmin/templates/first.html

        default = TEXT
        default.value = fileadmin/templates/default.html
    }

    variables {
        content < styles.content.get
        content.select.pidInList.field = uid
    }
}

注意尊重 backend_layout_next_level 和主栏以外的内容。也比直接文件名更喜欢模板文件夹 (...RootPaths)。