Format.nl2br ViewHelper <f:format.nl2br>
Changed in version 14.0
The Render.text ViewHelper <f:render.text> should be used whenever text fields from records are displayed in HTML output.
Depending on the TCA definition of the rendered field nl2br is then
automatically applied for multi line text areas.
Wrapper for PHPs
nl2br function.
See https://www.php.net/manual/function.nl2br.php.
Go to the source code of this ViewHelper: Format\Nl2brViewHelper.php (GitHub).
Table of contents
Preserving line breaks in HTML output
HTML ignores line breaks within text. To display text while preserving line
breaks, you must convert newline characters such as \\ or \\ into
HTML line break elements
<br />.
The <f: ViewHelper uses PHP's
nl2br() function
to insert HTML line breaks.
This is
a
string
<f:format.nl2br>{userInput}</f:format.nl2br>
or inline:
{userInput -> f:format.nl2br()}
This is<br />
a<br />
string
Arguments of the <f:format.nl2br> ViewHelper
value
-
- Type
- string
string to format