mr_typo3
mr_typo3

Reputation: 97

Backend Layout in TS file in TYPO3 CMS 7.6.18 how to get it working?

To be able to use different templates in a TYPO3 CMS 7.6.18 setup. I include a pageTSConfig.ts file with a backend layout looking like this. (see also this pastebin: https://pastebin.com/BcYKrYKh and this how it looks like in the TYPO3 object browser: https://pastebin.com/LVXqNUZC

### Backend Layouts #####

mod.web_layout.BackendLayouts{
1 {
  title = Standaard Layout
  config {
  backend_layout {
    colCount = 2
    rowCount = 1
    rows {
        1 {
            columns {
                1 {
                    name = linker_inhoud
                    colPos = 1
                }
                2 {
                    name = midden_inhoud
                    colPos = 0
                }
            }
        }
    }
}

  }
}


}

Since the BE-Layout is done with a file, in my TSconfig.ts I have added pagets__0 to it like the manual mentioned. Still this is not working. What Am I missing here? This is a part of the TSconfig I have in place here is the complete config:

page.10.file.stdWrap.cObject = CASE
page.10.file.stdWrap.cObject {
    key.data = levelfield:-1, backend_layout_next_level, pagelayout, slide
    key.override.field = pagelayout
    default = TEXT
    default.value = fileadmin/templates/index.html
    pagets__0 = TEXT
    pagets__0.value = fileadmin/templates/index.html
    pagets__1 = TEXT
    pagets__1.value = fileadmin/templates/layouts/small_header_page.html
    pagets__2 = TEXT
    pagets__2.value = fileadmin/templates/layouts/alternatieve_pagina.html
}

All to be included with:

Upvotes: 0

Views: 1417

Answers (2)

Jo Hasenau
Jo Hasenau

Reputation: 2684

There is a difference between "backend_layout", which is a the name of a real database field that can be fetched by "levelfield" and "pagelayout", which is a kind of virtual field to get rid of the "levelfield" approach.

https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#pagelayout

key.data = pagelayout

should do the whole job for you and only in this case you can use stuff like

pagets__x

to access the actual layout.

So your code should either be:

page.10 = FLUIDTEMPLATE
page.10.file.cObject = CASE
page.10.file.cObject {
    key.data = pagelayout
    default = TEXT
    default.value = fileadmin/templates/index.html
    pagets__0 = TEXT
    pagets__0.value = fileadmin/templates/index.html
    pagets__1 = TEXT
    pagets__1.value = fileadmin/templates/layouts/small_header_page.html
    pagets__2 = TEXT
    pagets__2.value = fileadmin/templates/layouts/alternatieve_pagina.html
}

or it should be

page.10 = FLUIDTEMPLATE
page.10.file.cObject = CASE
page.10.file.cObject {
    key.data = levelfield:-1, backend_layout_next_level, slide
    key.override.field = backend_layout
    default = TEXT
    default.value = fileadmin/templates/index.html
    1 = TEXT
    1.value = fileadmin/templates/layouts/small_header_page.html
    2 = TEXT
    2.value = fileadmin/templates/layouts/alternatieve_pagina.html
}

But not a mix of both approaches.

Upvotes: 2

Euli
Euli

Reputation: 1143

Before I tell you what might be wrong with your code, let me explain you a few things.

You have placed your templates in the fileadmin directory. This is not the place where to put these files any longer, because the fileadmin is a public place for resources like images, videos or documents. It might be available for every backend user in the filelist and the editor should not be able to edit the template in any case. The suggested way to handle your templates is to put them into an own extension that can be installed via the extension manager.

In your pastebin snippets, there is a line with userFunc = tx_templavoila_pi1->main_page, you may mixing up stuff in your installation and don't want to use FLUIDTEMPLATE alongside templavoila, because it could be confusing what rendering method is used for what stuff on your page. Better stick to templavoila or Fluid for the entirety of the TYPO3 installation.

Now, you have these lines in your TypoScript:

key.data = levelfield:-1, backend_layout_next_level, pagelayout, slide
key.override.field = pagelayout

There is no field pagelayout in the pages records. The field you rather want to address is backend_layout.

Upvotes: 0

Related Questions