[TYPO3-50-general] TypoScript syntax: Array indexes

Robert Lemke robert at typo3.org
Thu Jul 19 13:16:10 CEST 2007

Hi Elmar,

Am 19.07.2007 um 12:58 schrieb Elmar Hinz:

>> This definition implies that "anotherObject", "sub1" and "sub2"
>> should behave like an array, but they haven't been defined anywhere!
>> We could agree on that if objects are created _implicitly_, they
>> don't become true "ContentArray" objects but are just dumb PHP arrays
> we learn from other languages like JAVA or Ruby that it's quite  
> useful, if
> all thingies have an object nature. I think of objects, that  
> implement the
> PHP5 Interfaces "ArrayObject" and "Iterator". That gives us the  
> possibility
> to enrich these class with other useful functions when needed. We  
> couldn't
> do that with plain arrays.

yes, that's also something nagging me: I implemented the TS object  
tree only as
an array to solve that implicit array generation, in the hope that we  
find a
better solution with objects only.

What I imagine is that this code:

obj1.obj2.obj3 = Text

is just the short cut (and has the same result as writing):

obj1 = Array
obj1.obj2 = Array
obj1.obj2.obj3 = Text

or with the new syntax, which still doesn't make me really happy:

obj1 = Array
obj1."obj2" = Array
obj1."obj2"."obj3" = Text

Note that "Array" will be expanded into "T3P_CMS_TypoScript_Array"  
which is a
TypoScript object with Array behaviour - but not a Content Object. It  
can't be rendered. If you want to render obj1, you'd have to define  
the whole
structure explicitly:

obj1 = ContentArray
obj1.obj2 = ContentArray
obj1.obj2.obj3 = Text


More information about the TYPO3-project-5_0-general mailing list