[TYPO3-v4] Array support for cObject (was: Re: [TYPO3-core] RFC #17420: Add LOOP cObject)
Ernesto Baschny [cron IT]
ernst at cron-it.de
Mon Jan 31 18:36:45 CET 2011
Hi Xavier,
I think this its going in a nice direction here.
But I would prefer to discuss the specifications of it first in the v4
list, and maybe gather some suggested syntaxes via Wiki. I think it has
to be a team efford to bring this new functionality to the core, and I
guess plenty of people have thought about it already.
For example, your particular suggestion below (ARRAY cObject):
I would prefer that a cObject (upper case object) *always* returns a
string (render() returns a string as of its abstract super class).
So in my eyes, it should be some new function which returns arrays for
other TypoScript methods to work with.
For example just like the "select." returns a SQL resource, an "array."
stdWrap method could return an array etc.
What do you think?
Cheers,
Ernesto
Xavier Perseguers schrieb am 31.01.2011 18:02:
> Hi,
>
>>> 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.
>
> What we should have then is yet another cObj "ARRAY" for instance which
> would work a bit like a COA but would return a PHP array instead,
> possibly supporting alternative input with some Iterator (if really
> needed). This way, you could write something like that:
>
> page.10 = LOOP
> page.10.input = ARRAY
> page.10.input {
> 10 = ARRAY_ITEM
> 10 {
> firstKey = TEXT
> firstKey.data = GP:foo
>
> secondKey = 10
> }
> 20 = ARRAY_ITEM
> 20 {
> firstKey = 20
> secondKey = 30
> }
> }
> page.10.renderObj = COA
> page.10.renderObj.10 = TEXT
> page.10.renderObj.10.field = firstKey
> page.10.renderObj.10.wrap = <strong>|:</strong>
> page.10.renderObj.20 = TEXT
> page.10.renderObj.20.field = secondKey
>
> I wrote that quickly, it may be slightly different but for me this is
> another (useful) RFC.
>
> Xavier
More information about the TYPO3-project-v4
mailing list