Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
Format.stripTags ViewHelper <f:format.stripTags>
Removes tags from the given string (applying PHPs strip_
function)
See https://www.php.net/manual/function.strip-tags.php.
Examples
Default notation
<f:format.stripTags>Some Text with <b>Tags</b> and an Ümlaut.</f:format.stripTags>
Some Text with Tags and an Ümlaut. strip_
applied.
Note
Encoded entities are not decoded.
Default notation with allowedTags
<f:format.stripTags allowedTags="<p><span><div><script>">
<p>paragraph</p><span>span</span><div>divider</div><iframe>iframe</iframe><script>script</script>
</f:format.stripTags>
Output:
<p>paragraph</p><span>span</span><div>divider</div>iframe<script>script</script>
Inline notation
{text -> f:format.stripTags()}
Text without tags strip_
applied.
Inline notation with allowedTags
{text -> f:format.stripTags(allowedTags: "<p><span><div><script>")}
Text with p, span, div and script Tags inside, all other tags are removed.
Source code
Go to the source code of this ViewHelper: StripTagsViewHelper.php (GitHub).
Arguments
The following arguments are available for <f:
:
value
-
- Type
- string
String to format
allowedTags
-
- Type
- string
Optional string of allowed tags as required by PHPs strip_tags() f
unction