0

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?

Urs
  • 4,984
  • 7
  • 54
  • 116

1 Answers1

1

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
Urs
  • 4,984
  • 7
  • 54
  • 116
Bernd Wilke πφ
  • 10,390
  • 1
  • 19
  • 38
  • It produces an error, but I could add `isGreaterThan.stdWrap.numRows.table = tt_content` and the error is gone. Still, I haven't got it to work yet. I also forgot a line in the question. Will edit it right now – Urs Oct 11 '17 at 12:02
  • you are right: I forgot the table. I changed my example to copy the complete CONTENT object though only table and select are neccessary – Bernd Wilke πφ Oct 11 '17 at 12:33
  • if you are unsure about a rendered typoscript value try to print it. I will add a section to my answer. – Bernd Wilke πφ Oct 12 '17 at 05:36
  • Wonderful, I've been asking that myself all the time, how I could debug TS better. – Urs Oct 12 '17 at 09:48
  • you also can use the [admin-panel](https://www.typo3lexikon.de/typo3-tutorials/installation/adminpanel-admpanel.html). – Bernd Wilke πφ Oct 12 '17 at 10:13
  • Which option(s)? Track content rendering? – Urs Oct 13 '17 at 21:31
  • Actually it wasn't typos only: pidInList was missing. It was provided by a constant that was received in TS later on, after the `if` condition had been executed – Urs Oct 13 '17 at 21:42
  • how could it be? all typoscript constants are resolved (recursive) before rendering of typoscript setup is started. – Bernd Wilke πφ Oct 16 '17 at 05:34
  • It's not actually the constant that is changed, it's the TS that receives the constant later on (the constant is something `storagePidSection1 = 123`, and then in TS later on `pidInList = {$storagePidSection1}` etc – Urs Oct 16 '17 at 09:19