Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Embed an iframe into a page

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 6645 Views
  • stuartm
    Avatar
    Community Member
    4 Posts

    Embed an iframe into a page Link to this post

    Hope someone can help, I'm trying to embed an iframe into a webpage but the <iframe> code is being stripped out. I searched the forums and could only find reference to an iframe module, but that doesn't seem to allow you to have normal content as well as an iframe on a page. Can someone please explain how to allow iframes?

    Thanks - Stuart.

  • Phalkunz
    Avatar
    69 Posts

    Re: Embed an iframe into a page Link to this post

    By default, iFrame is not enabled by TinyMCE (the visual editor). To enable it, add iframe[src|width|height] to extended_valid_elements in /cms/javascript/tinymce.template.js. After adding it would look like this extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],iframe[src|width|height]"

    NOTE: make sure there is NO space between the comma and iframe.

  • stuartm
    Avatar
    Community Member
    4 Posts

    Re: Embed an iframe into a page Link to this post

    Thanks for that, it worked perfectly. Although I'm not a fan of editing core files as I need to be careful when performing upgrades. I come from a Wordpress background and you can create a plugin to extend the tags allowed in the TinyMCE - is there anything similar in Silverstripe?

  • Phalkunz
    Avatar
    69 Posts

    Re: Embed an iframe into a page Link to this post

    @stuartm: I come from Wordpress background as well and i'm very new to SilverStripe. you asked is there anything similar in Silverstripe? I'm not sure what you mean by that. If you have any specific question post it up in the form.
    Cheers.

  • stuartm
    Avatar
    Community Member
    4 Posts

    Re: Embed an iframe into a page Link to this post

    My question was "can you create a plugin to extend the tags allowed in TinyMCE?"

  • Phalkunz
    Avatar
    69 Posts

    Re: Embed an iframe into a page Link to this post

    That I'm not sure about but as far as I am concerned modifying conf in TinyMCE is easier than creating a plugin. You might wanna post a new question asking whether you can create a plugin/module that changes the behaviour of TinyMCE.

  • stuartm
    Avatar
    Community Member
    4 Posts

    Re: Embed an iframe into a page Link to this post

    The problem with modifying the TinyMCE directly is that every time you do an upgrade, you'll overwrite your changes, unless you are sure you can keep track of all the changes you have made.

  • Phalkunz
    Avatar
    69 Posts

    Re: Embed an iframe into a page Link to this post

    Yep, you're right.

    6645 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.