typo3typoscriptfluidtypo3-9.x

Assign backend layout template file to FLUIDTEMPLATE


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


Solution

  • 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
        }
    }