我有一个带有 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/