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

Elmar Hinz elmar07 at googlemail.com
Thu Jul 19 12:40:11 CEST 2007


Robert Lemke wrote:

> 
> Am 19.07.2007 um 11:55 schrieb Robert Lemke:
>> page = Page
>> page.bodyTag = Text
>> page.thing = Text
>> page.10 = Text
>>
>> bodyTag: That's probably a property of the Page object.
>> thing: That might be a property but could also be the same as "10"
>> 10: That's probably a subobject because we know that numbers are
>> frequently used as indexes. Theoretically it could be a property, too.

Hi,

that's much clearer now. The point is that you want to make a clean decision
already during parsing.

page.thing = something ???

Your question is: Is this treated as an object porperty or is it an array
key of an internal object? You don't want to postpone this decision until
you know about the internals.

I see 2 alternatives.

A) PHP like:

A clean solution PHP coders will understand quickly.

page = Page
page.bodyTag = "<body>"
page[thing] = "Something"
page[10] = Text
page[10].value = "Hello"


B) Tranditional:

A solution current users of TS will understand better. Less to type.

Requirements:

Integers are not allowed as object properties. They are always array keys.
Strings as @rray keys need a special syntax.

page = Page
page.bodyTag = "<body>"
page.10 = Text
page.10.value = "Hello"
page. at thing = "Suggestion"

I like both. But there should be a clear decesion for one of them.

Regards

Elmar


























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