菜单

TYPO3: RTE embed / iframe tag

2012年05月22日 - typoscript

TYPO3: RTE embed / iframe tag

According to Google Analytics a lot of people are currently looking for a way to use embed tags within the (tt_news) RTE. By default the TYPO3 RTE will remove these embed tags, but it’s fairly easy to change this. In this tutorial I’ll show you how to insert an iframe, within the TYPO3 RTE.

iframe src=”http://www.baidu.com” frameborder=”0″ height=”225″ width=”400″
The most obvious way would be: Switch to HTML modus in the RTE, paste the code and save the content element. But as you might have experienced, this way you’ll end up with a nice HTML embed code printed in the frontend. Not so useful…

How to fix this?!
Since Vimeo uses an iframe, we need to make sure the RTE accepts this iframe-tag. So we need to change RTE behaviour when saving the content element or tt_news record. Insert the following TSConfig configuration into the Page TSConfig field:

RTE.default.proc.allowTags := addToList(iframe)
RTE.default.proc.entryHTMLparser_db.allowTags := addToList(iframe)

If you want to insert the iframe outside of a block tag like a P or a DIV, than you’ll need to following as well:

RTE.default.proc.allowTagsOutside := addToList(iframe)

Now the RTE will preserve the iframe when saving. But… still no iframe in the frontend!
The extension css_styled_content doesn’t render an iframe by default, so let’s change this:

In your TypoScript constants add the iframe to the following (default) code:

styles.content.links.allowTags := addToList(iframe)

Take a look in the frontend.

发表评论

电子邮件地址不会被公开。 必填项已用*标注