TypoScript: conditional wrap if more than one item

931 views Asked by At

hmm... my TypoScript skills seem to have become a bit rusty.

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

I would like to add the wrapper div only if styles.content.get returns more than one item for said colPos.

I've tried the following two variants:

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

and

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

also with an additional stdWrap before numRows. Everything returns false, even when there should be multiple results.

What is wrong?

1

There are 1 answers

9
Bernd Wilke πφ On BEST ANSWER

from typoscript definition I would guess:

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
}

for inspecting/debuggung the value of numRows you might use this:

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

which you can use in fluid

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

or in typoscript itself for output

page.3 < lib.numRows