templates - 如何将新模板添加到 Typo3 "Layouts"下拉列表

标签 templates typo3 typoscript

我有一个带有 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)”> 外观页面的可能布局选项的下拉列表中。方便!

现在我有一个 Shiny 的新模板,我想将其添加为一个选项。我可以通过将此代码添加到 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
}

但是没有香蕉。它没有出现在外观布局列表中,所以我无法将它应用到页面中。

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

最佳答案

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

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

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

参见 TSconfig

关于templates - 如何将新模板添加到 Typo3 "Layouts"下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9736951/

相关文章:

python - jinja2:宏选择宏或动态宏调用

typo3 - TYPO3 CMS 中的 dotenv-connector

typo3 - 通过 TypoScript 生成随机字符串

c++ - 通过 CRTP 使用派生类变量初始化基类静态常量变量

c++ - 为什么模板不隐式实例化为 const 或引用类型?

数组的 C++ 语法指针

apache2 - 为什么apache禁止通过符号链接(symbolic link)访问?

javascript - Nivoslider : change width and height of slider afterwards

typo3 - 显示来自 EXT :news in specific language 的记录

css - TYPO3 显示包含 css 类的子页面的内容