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.
Comment ViewHelper <f:comment>
This ViewHelper prevents rendering of any content inside the tag.
Contents of the comment will still be parsed thus throwing an Exception if it contains syntax errors. You can put child nodes in CDATA tags to avoid this.
Using this ViewHelper won't have a notable effect on performance, especially once the template is parsed. However it can lead to reduced readability. You can use layouts and partials to split a large template into smaller parts. Using self-descriptive names for the partials can make comments redundant.
Examples
Commenting out fluid code
Before
<f:comment>
This is completely hidden.
<f:debug>This does not get rendered</f:debug>
</f:comment>
After
Output:
Before
After
Prevent parsing
<f:comment><![CDATA[
<f:some.invalid.syntax />
]]></f:comment>
Output:
Will be nothing.
Source code
Go to the source code of this ViewHelper: CommentViewHelper.php (GitHub).
Note
<f:
has no arguments.