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

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Tue Jul 31 21:04:05 CEST 2007


Robert Lemke schrieb:
> Hi folks,
> 
> 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" and "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

The problem is that TS uses the same strange array notion of PHP to have 
an array type that mixes numerical indices with named indices.

I'd try to untangle that so that ContentArray takes only numeric indices 
by definition.

As a consequence eg the old PAGE object would have to be changed to look 
like this:

x = PAGE
x.content
x.content.10 = Text
x.someProperty

Other objects that don't need ordered arrays, could have properties that 
implement named arrays. eg the meta property of the page object:

x = PAGE
x.meta.author = Masi

Masi


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