TYPO3-Documentation/TYPO3CMS-Tutorial-Typoscript45Minutes

$data['page'] or $data['page.'] ?

Closed this issue · 2 comments

https://docs.typo3.org/m/typo3/tutorial-typoscript-in-45-minutes/master/en-us/TypoScriptOverview/TypoScriptAnArray/Index.html

will be converted to the following PHP array:
$data['page'] = 'PAGE';

Upon evaluation, a “PAGE” object will be created first, and the parameter $data['page.'] will be assigned to it.

Which is it, page or page.?

Technically both. The following TypoScript:

page = PAGE
page {
    test = 1
}

Will become:

$data = [
    'page' => 'PAGE',
    'page.' => [
        'test' => 1,
    ],
];

So the version with trailing dot is used for nested options, the one without for assignments. Otherwise one or the other information would be lost.

I just proposed a unflattened version of the PHP array which should make this clearer.