Search code examples
typo3fluid-layouttypo3-9.x

TYPO3 FLUID: How to use more than one template?


in older TYPO3 Versions there was a simple way, to have many different templates, but it seems this doesn't work in TYPO3 9.5 anymore.

10 = FLUIDTEMPLATE
10 {
    templateName = TEXT
    templateName.stdWrap.cObject = CASE
    templateName.stdWrap.cObject {
        data = pagelayout

        2 = TEXT
        2.value = 2Col2Row

        default = TEXT
        default.value = Default 
    }
    
    variables{          
        
        pageTitle = TEXT
        pageTitle.data = page:title
        siteTitle = TEXT
        siteTitle.data = TSFE:tmpl|setup|sitetitle
        rootPage = TEXT
        rootPage.data = leveluid:0
        logo = IMAGE
        logo {
            file = EXT:myExt/Resources/Public/Icons/mylogo_icon.png
            height = 73
            width = 60  
            params = class="navbar-brand-logo-normal" style="max-height: 100%;margin-right:15px;"
            alt = Home
            linktitle = 
        }           
    
        content < styles.content.get
        content.select.where = colPos = 0
        topright < styles.content.get
        topright.select.where = colPos = 5
        bottomleft < styles.content.get
        bottomleft.select.where = colPos = 6
        bottomright < styles.content.get
        bottomright.select.where = colPos = 7
    }
    
    dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        10 { 
            levels = 2
            includeSpacer = 1
            as = mainnavigation             
            #special = directory
            #special.value = 1,193,201          
            special = list
            special.value = 90,194,200,195,201
        }
        20 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        20 {
            entryLevel = 1
            levels = 2
            expandAll = 0
            includeSpacer = 1
            as = subnavigation
        }
        30 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        30 {
            special = rootline
            special.range = 0|-1
            includeNotInMenu = 1
            as = breadcrumb
            if {
                value = {$page.theme.breadcrumb.enableLevel}
                value {
                    insertData = 1
                    prioriCalc = 1
                    stdWrap.wrap = |-1
                }
                isGreaterThan {
                    data = level
                }
            }
        }
        40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        40 {
            levels = 2
            as = footer             
            special = list
            special.value = 196,197,198,199
        }
    }
    
    templateRootPaths {
        0 = EXT:myExt/Resources/Private/Templates/Page/
    }
    partialRootPaths {
        0 = EXT:myExt/Resources/Private/Partials/Page/
    }
    layoutRootPaths {
        0 = EXT:myExt/Resources/Private/Layouts/Page/
    }
}

includeCSS {
    file1 = EXT:myExt/Resources/Public/Css/bootstrap4-theme.min.css
    fule3 = EXT:myExt/Resources/Public/Css/ext/base.css
    file5 = fileadmin/Resource/services/fontawesome582/css/all.css
}

includeJS {
    jquery = EXT:myExt/Resources/Public/Scripts/jquery.min.js
    bootstrap = EXT:myExt/Resources/Public/Scripts/bootstrap.min.js
    bootstrap = EXT:myExt/Resources/Public/Scripts/bootstrap.navbar.min.js
}
}

The paths are working for it shows the default page. I can't figure out, what I miss to take another template. All backend layouts and template files are where they have to be.


Solution

  • Ahhhh, thank you all so much for your answers and hints - so I could search the right things and could find the solution.

    key.data = pagelayout
                
    pagets__standard = TEXT
    pagets__standard.value = Default    
    
    pagets__2_col_2_row = TEXT
    pagets__2_col_2_row.value = 2Col2Row
    
    default < .pagets__standard
    

    I only had to give the alternative the name from the backend layout with prefix "pagets__" which seems very simple if one think about it.