[TYPO3-core] RFC #17420: Add LOOP cObject

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Jan 31 17:28:34 CET 2011


Hi Xavier,

I also like that feature.

Some comments:

Xavier Perseguers schrieb am 31.01.2011 16:48:

> Problem:
> TYPO3 is missing a content object to loop over arrays.
> 
> Solution:
> Provide a LOOP content object to "loop" over an array of arbitrary data.
> 
> Remark:
> If you have some collection that implements the Iterator interface, you
> should transform it into an array using PHP's built-in method:
> 
> iterator_to_array($yourIterator, TRUE)
> 
> otherwise tslib_content won't be happy as there is many places expecting
> ->data to be an array.

... which is why I wouldn't fiddle with cObj->data, because it is not
intended to be used like that. It expects data['uid'] etc.

Why not introduce a new ->dataArray which could be anything implementing
the "Iterator" class? This allows much more flexible ways of passing
data to this LOOP without having to "pre-fill" an array.

And I was thinking: would this be more like a new feature on top of
"CONTENT"? So that you could say CONTENT.selectArray (selecting from the
internal array) instead of CONTENT.select (which selects from SQL)?

Maybe we then also need some ways in TypoScript to manipulate this new
dataArray? :)

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list