Hi o/ I have a problem embeding iframes into a page :( I'm using SS 2.3.0 and I can't embed iframe like google maps.I searched on the forum but it didn't help. I tried this method: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]" - but when I opened that file there wasn't that string. Help
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Page 11(current)
- 2
- Next 10 entries
In SS 2.3.0 the code you want to change is commented out in /cms/javascript/tinymce.template.js
look in jsparty\tiny_mce2\tiny_mce_src.js
search for 'valid_elements :' should around line 6760
add iframe[src|width|height] here and that should do the trick for you
Hi,
I want to try to do the same , embed an inframe, but hacking jsparty/tiny_mce2/tiny_mce_src.js by adding iframe[src|width|height] in the valid elements list doesn't work for me.
I am running ss 2.3.0.
Do you have to do anything after add ?
Ste
Hi,
Below is the code I added, but adding iframe[src|width|height] also worked for me.
... img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],iframe [align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight| marginwidth|name|scrolling<auto?no?yes|src|style|title|width],-sub, ...
The contents of the iframe don’t load in the content editor (though you can set a border in editor.css to see where it is located), but do in the live site. The above just ensures the html is not striped out completely.
I am using 2.3.0-rc2, mistakenly said 2.3.0 in earlier post
If you don't need the iframe to be inside your text-content, but rather at the beginning or bottom of the page, you could simply create a special Page-Type for this scenario.
class EmbedPage extends Page
{
public static $db = array(
'EmbedCode' => 'HTMLText'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextareaField('EmbedCode', 'Embed Code'));
return $fields;
}
}
class EmbedPage_Controller extends Page_Controller {}
In the CMS you'll get a TextArea where you can paste your iframe code.
In the template you just add $EmbedCode below or above your content. For example:
<div class="typography">
<h2>$Title</h2>
$Content
$EmbedCode
</div>
Thanks! This helped me out a lot!
Just updated SS to 2.3.2 and you can embed a iframe through the edit html source button.
Thanks SS team and others.
Ste
Is there any way to stop the iframe being wrapped by a p tag?
- Page 11(current)
- 2
- Next 10 entries