How to add a new template to Typo3 “Layouts” drop-down list

▼魔方 西西 提交于 2019-12-08 07:37:26

问题


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]

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
}

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!

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?


回答1:


An alternative label does not help, if there is no item which will use your label.

You need to add the new item (Page TS Config!):

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

See TSconfig



来源:https://stackoverflow.com/questions/9736951/how-to-add-a-new-template-to-typo3-layouts-drop-down-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!