如何向 Typo3“布局"添加新模板下拉列表 [英] How to add a new template to Typo3 "Layouts" drop-down list
问题描述
我有一个带有 3 个现有布局选项的 Typo3 安装.这些都在 page.ts 文件中声明如下:
I have a Typo3 installation with 3 existing layout options. These are all declared in the page.ts file like so:
#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 文件的更下方,如下所示:
And they are all in this list further down the page.ts file, like so:
TCEFORM.pages {
layout.altLabels.0 = Normal
layout.altLabels.1 = Startpage
layout.altLabels.2 = Landing page
}
所有这些布局选项都显示在 CMS 的编辑页面 (X)"> 外观页面上,位于可能的布局选项的下拉列表中.好用!
All of these layout options are displayed in the CMS on the "Edit Page (X)" > Appearance page, in a drop-down list of possible layout options. Handy!
现在我有一个闪亮的新模板,我想将其添加为一个选项.我可以通过将此代码添加到 page.ts 来将其应用于特定的页面 id(例如,页面 id #563):
Now I have a shiny new template that I want to add as an option. I can apply it to a specific page id (say, page id #563) by adding this code to the page.ts:
[globalVar = TSFE:id=563]
page.10.template.file = fileadmin/template/shinynewtemplate.html
[GLOBAL]
但我似乎无法将其添加为下拉菜单中的新布局选项.我试过这个:
But I can't seem to add it as a new layout option in the drop-down menu. I have tried this:
#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
}
但没有香蕉.它没有出现在外观布局列表中,所以我无法将它应用到页面.
But no banana. It doesn't show up in the Appearance layout list, so I can't apply it to a page.
我错过了什么?是否还有其他地方需要声明此模板文件,以便它在下拉列表中显示为选项?
What am I missing? Is there somewhere else that I need to declare this template file so that it will show up as an option in the drop-down list?
推荐答案
如果没有项目会使用您的标签,则替代标签无济于事.
An alternative label does not help, if there is no item which will use your label.
您需要添加新项目(页面 TS 配置!):
You need to add the new item (Page TS Config!):
TCEFORM.pages {
layout.addItems.3 = Shiny new page
}
参见 TSconfig
这篇关于如何向 Typo3“布局"添加新模板下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!