2017-10-11 140 views
0

嗯......我的TypoScript技能似乎变得有点生疏。TypoScript:有条件地包装,如果多个项目

lib.feld < styles.content.get 
lib.feld.select.orderBy = rand() 
lib.feld.select.select.where = colPos=11 
lib.feld.wrap = <div class="wrapper">|</div> 

我想补充包装格比说colPos一个项目只有styles.content.get回报更多。

我试过以下两个变种:

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

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

也有附加stdWrap前numRows行。 即使应该有多个结果,一切都会返回false。

出了什么问题?

回答

1

从Typo脚本定义我猜想:

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 
} 

用于检测/ debuggung您可以使用此的numRows值:

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

,您可以在使用流体

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

或typoscript本身输出

page.3 < lib.numRows 
+0

它产生一个错误,但我可以添加'isGreaterThan.stdWrap.numRows.table = tt_content'并且错误消失了。不过,我还没有得到它的工作。我也在这个问题上忘了一行。现在编辑它 – Urs

+0

你是对的:我忘了桌子。我改变了我的例子来复制完整的CONTENT对象,尽管只有表格和选择是必要的 –

+0

如果您不确定渲染的typoscript值是否尝试打印它。我会在我的答案中添加一个部分。 –