简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM