Format.htmlentities ViewHelper <f:format.htmlentities>

Applies htmlentities() escaping to a value. See https://www.php.net/manual/function.htmlentities.php.

Examples

Default notation

<f:format.htmlentities>{text}</f:format.htmlentities>
Copied!

Text containing the following signs & " ' < > will be processed by htmlentities(). These will result in: &amp; &quot; &#039; &lt; &gt;.

Inline notation

{text -> f:format.htmlentities(encoding: 'ISO-8859-1')}
Copied!

Text containing the following signs & " ' < > will be processed by htmlentities(). These will result in: &amp; &quot; &#039; &lt; &gt;.

But encoded as ISO-8859-1.

Source code

Go to the source code of this ViewHelper: HtmlentitiesViewHelper.php (GitHub).

Arguments

The following arguments are available for <f:format.htmlentities>:

Name Type Default
string
boolean
string
boolean true

value

value
Type
string

String to format

keepQuotes

keepQuotes
Type
boolean

If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).

encoding

encoding
Type
string

Define the encoding used when converting characters (Default: UTF-8

doubleEncode

doubleEncode
Type
boolean
Default
true

If FALSE existing html entities won't be encoded, the default is to convert everything.