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

Elmar Hinz elmar07 at googlemail.com
Thu Jul 19 11:41:38 CEST 2007


> I've been thinking for some time now about an issue with the syntax
> of array indexes in TypoScript.
> Consider the following example:
> 
>     myArrayObject = ContentArray
> 
>     myArrayObject.10 = Text
>     myArrayObject.10.value = "Hello "
> 
>     myArrayObject.20 = Text
>     myArrayObject.20.value = "world!"
> 
> "myArrayObject" is a regular TypoScript content object which can be
> rendered. It probably has no properties itself but it does have Array
> capabilities, ie. it has sub objects. There are two sub objects,
> namely "10" a"20". When the ContentArray is rendered, it just
> aggregates the content of all sub objects.
> 
> So far so good. But not for the parser and not if we don't use
> numerical indexes. Consider this:
> 
>     myObject = Template
>     myObject.file = xyz
>     myObject.subParts.footer = Text
> 
> "file" is a property of the "Template" object and so is "subParts".
> However, subParts has Array behaviour (although it's no object) and
> footer is the index in that array. Now, from the parser's view this
> looks very ambiguous: How can it know (without knowing the internals
> of an object) that subParts behaves like an array?

Hi Robert,

there is a siginificant difference without knowing of internals. "subParts."
is a node with subnodes, while "file" is a leaf. The difference of "x"
and "x." So that should not be a problem.

Maybe you could give a better example for the ambiguity?

Regards

Ellmar









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