【问题标题】:How to add a new template to Typo3 "Layouts" drop-down list如何将新模板添加到 Typo3“布局”下拉列表
【发布时间】:2012-03-16 12:09:01
【问题描述】:

我有一个带有 3 个现有布局选项的 Typo3 安装。这些都在 page.ts 文件中声明,如下所示:

#normal layout:
[globalVar=TSFE:page|layout=0]
    page.10.template.file = fileadmin/template/classic-page.html
    page.includeCSS.screen = fileadmin/template/css/style.css
    page.includeCSS.screen.media = screen
[global]

而且它们都在 page.ts 文件下方的列表中,如下所示:

TCEFORM.pages {
layout.altLabels.0 = Normal 
layout.altLabels.1 = Startpage
layout.altLabels.2 = Landing page
}

所有这些布局选项都显示在 CMS 中的“编辑页面 (X)”> 外观页面的可能布局选项的下拉列表中。好用!

现在我有一个闪亮的新模板,我想将其添加为选项。我可以通过将此代码添加到 page.ts 来将其应用于特定的页面 id(例如,页面 id #563):

[globalVar = TSFE:id=563]
page.10.template.file = fileadmin/template/shinynewtemplate.html
[GLOBAL]

但我似乎无法将其添加为下拉菜单中的新布局选项。我试过这个:

#shiny new layout:
[globalVar=TSFE:page|layout=3]
    page.10.template.file = fileadmin/template/shinynewtemplate.html
    page.includeCSS.screen = fileadmin/template/css/style.css
    page.includeCSS.screen.media = screen
[global]

TCEFORM.pages {
layout.altLabels.0 = Normal 
layout.altLabels.1 = Startpage
layout.altLabels.2 = Landing page
layout.altLabels.3 = Shiny new page
}

但没有香蕉。它没有出现在外观布局列表中,因此我无法将其应用于页面。

我错过了什么?我是否需要在其他地方声明此模板文件,以便它在下拉列表中显示为选项?

【问题讨论】:

    标签: templates typo3 typoscript


    【解决方案1】:

    如果没有项目会使用您的标签,则替代标签无济于事。

    您需要添加新项目(Page TS Config!):

    TCEFORM.pages {
      layout.addItems.3 = Shiny new page
    }
    

    TSconfig

    【讨论】:

    • 完美,这正是我想要的。我闪亮的新布局现在可以在布局下拉列表中使用,并且一切正常。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-08
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多