[TYPO3-english] fedext fluid temlplate selected as class of body

jaco graaff jaco at spacexplorer.co.za
Wed Sep 25 04:59:25 CEST 2013


I would like to reflect the chosen template ("threeColumn", "twoColumn") as 
a class in the body tag

I am using https://fedext.net/ - meaning the templates are not "defined" in 
pure Typoscript

I can send a variable from a fluid template to typoscript:

in ThreeColumnTemplate.html
-------------------------------------------------------------------------------------------
<f:cObject typoscriptObjectPath="lib.bodyClassFromTemplate"
                 data="{template:'threeColumnT5'}" />
---------------------------------------------------------------------------------------------

in Typoscript setup:
-------------------------------------------------------------------------------------------
lib.bodyClassFromTemplate = COA
lib.bodyClassFromTemplate {
    10 = TEXT
    10{
//get value from fluid-template
        field = template
        wrap = |fromFluidTemplate
    }
}

AND

page.bodyTag >
page.bodyTagCObject = COA
page.bodyTagCObject {
    10 = TEXT
    10 {
        value = <body class="
    }

    20 = TEXT
    20 {
        field = uid
        wrap = uid-|
    }

    30 = cObject
    30 =< lib.bodyClassFromTemplate
    30{
    wrap =  &nbsp;|
    }

    50 = TEXT
    50 {
        value = ">
    }
}



-------------------------------------------------------------------------------------------



OUTPUT:

<body class="uid-11 fromFluidTemplate"
//note: the value is not in the class file - it might be that the Typoscript 
value of lib.bodyClassFromTemplate was generated BEFORE the fluid-template 
send the value to Typoscript

AND in the html content

    --threeColumnT5fromFluidTemplate--
//note: the value is in the content of the HTML file at the location it was 
defined in the template which means it has successfully send the value to 
Typoscript and rendered the Typoscript processed value.






More information about the TYPO3-english mailing list