【问题标题】:Typo3 onepage include subpages with their own templatesTypo3 onepage 包含带有自己模板的子页面
【发布时间】:2016-12-22 08:55:53
【问题描述】:

我有一个带有单页布局的 Typo3 网站。该网站有几个部分(新闻、投资组合、幻灯片、...)。每个部分都有自己特定的布局/模板。在 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>
          }
        }
      }
    }
  }
}

但我也需要使用过的模板。我需要一种将子页面与其模板集成到父页面/单页网站中的方法。

【问题讨论】:

    标签: typoscript typo3-7.6.x


    【解决方案1】:

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

    所以你的 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)而不是直接文件名。

    【讨论】:

    • 将“.value”添加到第二个“默认值”我已经找到了我正在寻找的模板。谢谢你。但是还是没有内容。我在模板中使用 。有什么建议吗?
    • 哎呀。我添加了缺少的.value。 f:cObject 的问题可能是您可能会错过一些上下文。例如您可能会错过 page-uid。我的示例只能工作,因为我们在 TMENU.1 的上下文中,因此我们可以访问当前在菜单中处理的页面的字段。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-24
    • 1970-01-01
    • 2016-03-22
    • 2019-02-16
    • 2016-09-11
    相关资源
    最近更新 更多