Alternative notation for multiline values: The HEREDOC syntax ( “<<<” )

The HEREDOC typoscript syntax echoes the HEREDOC syntax of php (see http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc ).

One should provide an identifier (followed by new line) after <<<, then the multiline string, and then the same identifier followed by “;” (semicolon) to close the quotation.

To be used as an alternative to ( ) signs when there is the need to have parenthesis starting a line in the multiline value, without being interpreted as the end-parenthesis of the multiline block by the typoscript parser.

Example:

myObject = HTML

myObject.value <<<MYVALUE

If you need to merge two arrays,<br />

use the static function t3lib_div::array_merge($arr1, $arr2) like this:<br />

<pre>

$arr1 = array(

0 => 'hello',

);

$arr2 = array(

1 => 'World',

2 => '!',

);

$merged = t3lib_div::array_merge(

$arr1,

$arr2

);

</pre>

MYVALUE;

You can choose whatever you want as an identifier (here, MYVALUE).

Rules:

Just as for ( ) signs, the end-statement is extremely important as if it is not found, the parser does not return to parsing TypoScript. This includes the [GLOBAL] condition which will not save you! So don't miss it!

Unlike php's HEREDOC, the closing statement is not required to be placed at the first char of the line, as long as it's the first non-whitespace substring of the line.

TypoScript Syntax and In-depth Study - 1

TypoScript Syntax and In-depth Study

Kasper Skårhøj

2002-11-01T00:32:00

Kasper Skårhøj