21306 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 4752 Views |
-
Embed an iframe into a page

11 March 2009 at 10:55pm
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 -
Re: Embed an iframe into a page

18 March 2009 at 3:24am
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
-
Re: Embed an iframe into a page

19 March 2009 at 2:49am
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
-
Re: Embed an iframe into a page

20 March 2009 at 10:37am Last edited: 20 March 2009 10:42am
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
-
Re: Embed an iframe into a page

3 April 2009 at 9:08am
I had a problem adding onmousemove attributes to an IMG tag so I added
,
extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]"(Don't forget - all but the last entry must end with a coma)
At the end of TinyMCE.init() in cms/javascript/tinymce.template.js (as recommended by Moxy and suggested in earlier posts).
That didn't work.
It seems that SilverStripe has modified tiny_mce_src.js and is no longer accepting that approach.
So if you want to change accepted tags/attributes you have to modify that source file.
--------------------------------If anyone is having trouble adding XHTML valid tags and or attributes to their pages here's what I found:
- If you change the name of the jsparty/tiny_mce2/tiny_mce_src.js the editor will no longer load so the raw HTML is visible in the textarea. (edit away)
- tiny_mce_src.js shouldn't even be getting loaded. It's 262KB long.
tiny_mce.js has been compressed with Dean Edwards javascript compressor and is only 157KB long.
that should be getting loaded.So the best fix without hacking SilverStripe might be.
- rename tiny_mce_src.js to my_tiny_mce_src.js
- edit the file as indicated in the previous post
- run the edited file through Dean's compressor (javascriptcompressor.com)
- write the compressed result to tiny_mce_src.jsI guess TinyMCE is under development so rather than run it through the compressor after every change SilverStripe decided to just load the source. Too bad because 262K is quite a load.
- Kent
-
Re: Embed an iframe into a page

4 April 2009 at 6:06am
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> -
Re: Embed an iframe into a page

20 July 2009 at 12:35am
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
| 4752 Views | ||
|
Page:
1
|
Go to Top |



