Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » adding iFrames to a page

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1180 Views
  • tchintchie
    Avatar
    Community Member
    63 Posts

    adding iFrames to a page Link to this post

    I know this has been discussed previously but somehow no one came to a solution (at least not a simple one) so my question is (once again) IS there a (simple) way to add an iFrame (such as googlemaps) to any page using the standard editor? I´m even willing to hardcode it to the specific page but (don´t laugh at me) I have no clue where to find the html code for e.g. my contact page?? There probably is none, right? :-p
    It can´t be that hard, can it???

    btw: using SS 2.4.5

  • SSadmin
    Avatar
    Community Member
    90 Posts

    Re: adding iFrames to a page Link to this post

    you could turn off the tinycme default validator by inserting the following code into mysite/_config.php

    HtmlEditorConfig::get('cms')->setOption('verify_html', 'false');// turn off html validation

    or

    HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', "+iframe[src|width|height]");

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: adding iFrames to a page Link to this post

    thanks for the reply. I added the latter code to my _config.php and ran a dev/build. Sorry for asking this but how am I to copy the iFrame into my page after that? Is there supposed to be a special field/tab? Simply pasting the code into the html editor doens´t work ...

  • SSadmin
    Avatar
    Community Member
    90 Posts

    Re: adding iFrames to a page Link to this post

    well, you could be able to create a HTMLText in your page.php

    static $db=array(
    'GoogleMapArea'=>'HTMLText'
    )

    Then add fileds to your page.php

    public function getCMSFields(){
    $fields=parent::getCMSFields;

    $fields->addFieldToTab("Root.Content.GoogleMapArea", new TextArea('GoogleMapArea','Google Map Area'));

    return $fields;

    }

    then you should be able to paste your code (iframe)into that area block.

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: adding iFrames to a page Link to this post

    Wow that worked great!! couldn´t find the button at first cause it has no decoration icon

    many thanks!!!

    1180 Views
Page: 1
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.