TYPO3 fluid 变量

3

我将我的TYPO3从7.6升级到了8.6版本。 现在我不能通过style.content.get设置变量,我的根模板加载fluid_styled_content。 一些源代码:

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

显示变量:

<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>
3个回答

2
在TYPO3 8.6版本中存在一个错误:https://forge.typo3.org/issues/80044 在将styles.content.get分配给您的variables之前,请添加以下内容: <INCLUDE_TYPOSCRIPT: source="FILE:EXT:frontend/ext_typoscript_setup.txt"> 然后您可以像以前一样使用它。

2

styles.content.get 定义在 ext:fluid_styled_content 中,但是很晚定义,导致大多数拷贝为空。引用也不是解决方案,因为对 colPos 的修改将应用于所有引用。

目前最好的解决方案似乎是在您的 TS 中提前定义自己的 styles.content.get

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

但是由于这是自己定义的,我会将其重命名为temp.content.get,以便将其识别为我的自定义版本(如果全局定义更改,则不会混淆)


1

已解决 感谢Bernd!问题已解决。 以下是完整示例:

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

1
如果有人帮助您回答问题,请要求他将评论放入答案中,并接受和/或点赞,建议删除自己的答案,这是您的决定。 - Gang
1
在我的解决方案中,我建议使用temp.content.get,因为所有以temp.开头的TS对象都会在渲染执行之前被删除,从而导致更小的配置数组。特别是对于需要复制的原型,它们在渲染时不需要知道。 - Bernd Wilke πφ

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接