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

Ila picture Ila · Mar 16, 2012 · Viewed 8.3k times · Source

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?

Answer

maholtz picture maholtz · Mar 16, 2012

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