MightyA
MightyA

Reputation: 26

How can I omit html tags with displaying rte content on the TYPO3 frontend?

I'm querying the text from an RTE (rich text editor) with fluid, so it gets displayed with the frontend, including the HTML tags (used with the RTE). How can I omit those HTML tags (and instead get them evaluated)? Why get they even displayed (as plain text)? I'm using the RTE with a custom content element. Should I review that element?

Upvotes: 0

Views: 804

Answers (1)

Rudy Gnodde
Rudy Gnodde

Reputation: 4565

Variables in Fluid are passed through htmlspecialchars by default when used directly in the template. To output HTML input in the backend RTE you need to surround it with a <f:format.html> tag. For example: <f:format.html>{myVariable}</f:format.html>. This also does things like add p-tags if needed, replace <link...> tags with actual links, etc. More on this ViewHelper you can find at https://docs.typo3.org/other/typo3/view-helper-reference/master/en-us/typo3/fluid/latest/Format/Html.html

If you want to add a variable as is, without any processing, you should surround it with a <f:format.raw> tag. For example: <f:format.raw>{myVariable}</f:format>. More on this ViewHelper you can find at https://docs.typo3.org/other/typo3/view-helper-reference/master/en-us/typo3fluid/fluid/latest/Format/Raw.html

Upvotes: 1

Related Questions