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

Robert Lemke robert at typo3.org
Thu Jul 19 13:00:33 CEST 2007


Am 19.07.2007 um 12:40 schrieb Elmar Hinz:

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

exactly.

> 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"

yes. Only change: page["thing"] = "Something".

> 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"

would be possible, too, but maybe with this special syntax:

page.10 = Text
page.10.value = "Hello"
page."thing" = Text
page."thing".value = "Suggestion"

So the rule in EBNF for a part of the object path would be:

ObjectPath = [ "." ] ObjectIdentifier { "." ObjectIdentifier }  
( [ "." VariableName ] | [ ArrayOffset ] );
VariableName = "$" Identifier;
ArrayOffset = Number | Literal
Literal = DoubleQuotedLiteral | SingleQuotedLiteral;

Well, that would be an option.

robert
-- 
http://typo3.org/gimmefive




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