TypoScript:如果有多个项目,则为条件换行

时间:2017-10-11 07:52:32

标签: typo3 typoscript typo3-7.6.x typo3-7.x fluid-styled-content

嗯......我的TypoScript技能似乎有点生疏。

C = 

  struct with fields:

        id: {'x1'  'x4'  'x5_TTa'  'x6_TTa'  'x2'  'x9'  'x5_TTb'  'x6_TTb'  'x7'}
    values: [7×9 double]
     dates: [7×1 double]

我想仅在 lib.feld < styles.content.get lib.feld.select.orderBy = rand() lib.feld.select.select.where = colPos=11 lib.feld.wrap = <div class="wrapper">|</div> 为所述styles.content.get返回多个项目时才添加包装器div。

我尝试了以下两种变体:

colPos

lib.feld.wrap.if {
    isGreaterThan.numRows < styles.content.get
    isGreaterThan.numRows.select.where = colPos=11
    value = 1
}

在numRows之前还有一个额外的lib.feld.wrap.if { isGreaterThan.numRows.table = tt_content isGreaterThan.numRows.select < styles.content.get.select isGreaterThan.numRows.select.where = colPos=11 value = 1 } 。 即使应该有多个结果,一切都会返回错误。

有什么问题?

1 个答案:

答案 0 :(得分:1)

来自typoscript定义我猜:

temp.feld < styles.content.get
temp.feld.select.where = colPos=11
temp.feld.select.orderBy = rand()
temp.feld.select.pidInList = 123

lib.feld < temp.feld
lib.feld.wrap = <div>|</div>
lib.feld.wrap.if {
    isGreaterThan.stdWrap.numRows < temp.feld
    value = 1
}

用于检查/调试numRows的值,您可以使用它:

lib.numRows = TEXT
lib.numRows.numRows < temp.feld
lib.numRows.wrap = numRows=[|]

你可以在流体中使用

{f:cObject(typoscriptObjectPath:'lib.numRows')}

或在typoscript本身输出

page.3 < lib.numRows
相关问题