Alex Kau
Alex Kau

Reputation: 41

TYPO3 fluid variables

I upgrade my TYPO3 from 7.6 to 8.6. Now I cant set variables via style.content.get, my root template loads fluid_styled_content. some source:

page.10 = FLUIDTEMPLATE
page.10 {
    partialRootPath ={$resDir}/Private/Partials
    layoutRootPath = {$resDir}/Private/Layouts

   variables {
        contentMain < styles.content.get
        contentMain.select.where = colPos = 0
        contentnew < styles.content.get
        contentnew.select.where = colPos = 1
        contentkat < styles.content.get
        contentkat.select.where = colPos = 2

        test = TEXT
        test.value = loool
    }
}

display the variables:

<f:format.raw> {contentMain} </f:format.raw>
<f:format.raw> {contentnew} </f:format.raw>
<f:format.raw> {contentkat} </f:format.raw>
<f:format.raw> {test} </f:format.raw>

Upvotes: 3

Views: 908

Answers (3)

bandanh
bandanh

Reputation: 555

There is a Bug in TYPO3 8.6: https://forge.typo3.org/issues/80044

Add this before you assign styles.content.get to your variables: <INCLUDE_TYPOSCRIPT: source="FILE:EXT:frontend/ext_typoscript_setup.txt"> Then you can use it just as before.

Upvotes: 2

Kau
Kau

Reputation: 11

SOLVED Thanks to Bernd! Solved this problem. Here a full example:

mystyles.content.get = CONTENT 
mystyles.content.get {
    table = tt_content
    select {
        orderBy = sorting
        where = colPos=0
    }
}


page.10 = FLUIDTEMPLATE
page.10 {
    partialRootPath ={$resDir}/Private/Partials
    layoutRootPath = {$resDir}/Private/Layouts

    variables {
        contentMain < mystyles.content.get
        contentMain.select.where = colPos = 0
        contentnew < mystyles.content.get
        contentnew.select.where = colPos = 1
        contentkat < mystyles.content.get
        contentkat.select.where = colPos = 2

        test = TEXT
        test.value = loool
    }
}

Upvotes: 1

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10791

styles.content.get is defined in ext:fluid_styled_content but very late so most copies are empty. References are no solution as the modification for colPos would apply to all references.

At the moment the best solution seems to be an own definition of styles.content.get early in your TS:

styles.content.get = CONTENT 
styles.content.get {
    table = tt_content
    select {
        orderBy = sorting
        where = colPos=0
    }
}

but as it is an own definition I would rename it to temp.content.get so it is identifiable as my own version (no confusion if the global definition changes)

Upvotes: 2

Related Questions