.. ==================================================
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.
.. include:: ../../Includes.txt
.. _typoscript-array:
TypoScript is just an array
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Internally, TypoScript is just stored in a PHP array. It is used and
evaluated by various classes according to object types. ::
page = PAGE
page.10 = TEXT
page.10.value = Hello World
page.10.stdWrap.wrap =
|
will be converted to the following PHP array ::
$data['page'] = 'PAGE';
$data['page.']['10'] = 'TEXT';
$data['page.']['10.']['value'] = 'Hello World';
$data['page.']['10.']['stdWrap.']['wrap'] = '|
';
On evaluation, the object ":ref:`PAGE `" will be created
first, and the parameter $data['page.'] will be assigned. The object
":ref:`PAGE `" will then search for all properties, which
define it. In this case, it will just find a numeric entry "10", which
has to be evaluated. A new object ":ref:`TEXT `"
with the parameter $data['page.']['10.'] will be created. The object
":ref:`TEXT `" knows the parameters "value" and
"stdWrap". It will set the content of "value" accordingly. The
parameters from "stdWrap" will be passed to the function stdWrap.
(That's how ":ref:`TEXT `" is implemented. We will
elaborate on stdWrap later). There the property 'wrap' is known, and
the text "Hello world" will be inserted at the pipe (\|) position and
returned.
This relationship is important to understand the behavior of
TypoScript in many cases. If, for example, the TypoScript is extended
with the following line::
page.10.myFunction = Magic!
this entry will be added to the PHP array::
$data['page.']['10.']['myFunction'] = 'Magic!';
However, the object :ref:`TEXT ` does not know the
property "myFunction". Consequently, the entry will have no effect.
No semantic error checking is done. If you define an object or
properties, which do not exist, you will not see an error message.
Instead, those specific lines of TypoScript simply do nothing. This
should be considered, especially while troubleshooting.