Rendering RTE content in the Frontend

The explanations on this page don't show how to display an RTE but rather, describe how rendering of content should be done in the frontend when it was entered with help of an RTE.

Fluid templates

Rich text editors enrich content with HTML and pseudo HTML (for example a special link syntax). You should therefore always render the output of a RTE field with the Format.html ViewHelper <f:format.html>:

packages/my_extension/Resources/Private/Templates/MyContentElement.html
<f:format.html>{data.bodytext}</f:format.html>
Copied!

TypoScript

Rendering is sometimes done by TypoScript only, in those cases it is possible to use lib.parseFunc_RTE for parsing and rendering (see also TypoScript function parseFunc):

For example to render the bodytext filed of table tt_content without Fluid:

packages/my_extension/Configuration/Sets/MySet/setup.typoscript
tt_content.my_content_element = TEXT
tt_content.my_content_element {
  field = bodytext
  wrap = <p>|</p>
  stdWrap.parseFunc < lib.parseFunc_RTE
}
Copied!

Usually the TypoScript function typolink should be used for single links, but for text that might include several links that is not possible easily. Therefore lib.parseFunc_RTE is used to simplify and streamline this process.

Details to parseFunc can be found in the TypoScript Reference: