[TYPO3-english] TypoScript: Using array data - is it really impossible?

Mathias Bolt Lesniak, liliO Design mathias at lilio.com
Tue Jul 20 11:35:16 CEST 2010


Hi!

Is it really impossible to somehow use array data from GET/POST in TypoScript? I can't seem to find any way to get it to work.

Here's the issue:

URL is: index.php?id=1&test[]=x&test[]=y&test[]=z

How do I access the values of the "test" array without having to do "data = GP : test | 0", "data = GP : test | 1", etc. It won't work if I don't know the length of the array.

I imagine two solutions, but neither exist today. The first one (below) is the easiest, but both require tslib_cobj->getText() to return arrays.


SOLUTION 1:
(This doesn't work because "data = GP : test" will return an empty string, since it sees the array.)

page.10 = TEXT
page.10.data = GP : test
#Implode the array so I can explode it with "split"
page.10.implode = ,
page.10.split {
  token = ,
  cObjNum = 1
  1 = TEXT
  1.current = 1
  1.wrap = <p>|</p>
}


SOLUTION 2:
#Using a new cObject which iterates arrays
page.10 = ITERATE
page.10.data = GP : test
page.10.1 = TEXT
page.10.1.current = 1
page.10.1.wrap = <p>|</p>


The third solution would be to run everything though a custom USER function, but it's much less flexible.


Any ideas on how to achieve this though today's TypoScript versions would be much appreciated. :-)


Best wishes

Mathias Bolt Lesniak
LiliO Design - www.lilio.com
mathias at lilio.com


More information about the TYPO3-english mailing list