Assign backend layout template file to FLUIDTEMPLATE

92 Views Asked by At

I was using an old version of TYPO3 (9.5). I'm upgrading to newer version 10-12.

I'm struggling with this code snippet to upgrade the TEMPLATE=file section.

I know TEMPLATE=file is no longer supported. file=path is the way to do it.

I fetch data from backend_layout table and get filename store in database

10 = FLUIDTEMPLATE
10 {
    partialRootPath = {$filepaths.htmlpartials}
    layoutRootPath = {$filepaths.htmllayouts}
    template = FILE
    template {
        file.stdWrap.cObject = FILES
        file.stdWrap.cObject {
            references {
                table = backend_layout
                uid.data = levelfield:-1, backend_layout_next_level, slide
                uid.override.field = backend_layout
                fieldName = template
            }

            maxItems = 1

            renderObj = TEXT
            renderObj {
                data = file:current:publicUrl
            }
        }
    }
}

Can anyone give me a hint

3

There are 3 best solutions below

1
On BEST ANSWER

instead of

    template = FILE
    template {
        :
    }

just use:

    file {
        stdWrap {
            cObject = TEXT
            cObject {
                data = levelfield:-2,backend_layout_next_level,slide
                override.field = backend_layout
                split {
                    token = file__
                    1.current = 1
                    1.wrap = |
                }
                wrap = {$filepaths.htmltemplates}|.html
            }
        }
    }

EDIT:
formatted version of @SteveLeg comment:

file {
    stdWrap {
        cObject = FILES
        cObject {
            references {
                table = backend_layout
                uid.data = levelfield:-1, backend_layout_next_level, slide
                uid.override.field = backend_layout
                fieldName = template
            }
            maxItems = 1
            renderObj = TEXT
            renderObj {
                data = file:current:publicUrl
            }
        }
        debugFunc = 1
    }
}
0
On
0
On

In TYPO3 10.4.37, the following code works. Note that variables must be defined in the template and assigned to a back end layout in order to work.

10 = FLUIDTEMPLATE
10{
    file = fileadmin/template/template.html
    
    variables{
        main < styles.content.get
        main.select.where = colPos = 0
        aside < styles.content.get
        aside.select.where = colPos = 1
    }
}