21295 Posts in 5734 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » Couldn't add multiple iframes in my CMS page from admin panel
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 362 Views |
-
Couldn't add multiple iframes in my CMS page from admin panel

5 June 2012 at 3:19pm
Hi
I need to add multiple iframes in my music page. I want it to be done from admin panel. I added these lines clicking edit HTML source of the editor but greater than and less than sign are replaced by </p> <p><. I am newbie to silverstripe. Any help will be appreciated.
Sample Iframes:
<p><iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F4922141&show_artwork=true" /></iframe></p><p><iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F9111668&show_artwork=true"></iframe></p>
I had done some research and tried adding these lines in mysite/_config.php
HtmlEditorConfig::get('cms')->setOption('verify_html', 'false');
HtmlEditorConfig::get('cms')->setOption('element_format', 'html');
HtmlEditorConfig::get('cms')->setOption('cleanup', 'false');Also in mysite/code/Page.php
public function onBeforeWrite() {
$this->Content = preg_replace('|<iframe(.*)/>|Uims', '<iframe\\1> </iframe>', $this->Content);
parent::onBeforeWrite();
}BUT it didn't worked with me.
Thanks in advance
Sanjeev -
Re: Couldn't add multiple iframes in my CMS page from admin panel

5 June 2012 at 9:47pm Last edited: 5 June 2012 9:59pm
Use the RAW function when calling Content field of your page, e.g. $Content.RAW
It's better to have separate fields, or better, define a relation, that will hold these iframe URLs, and just have a control block and call the RAW function.
example:
<% control IframeURLs %>
IframeURL.RAW
<% end_control %>Just my 2 cents.
-
Re: Couldn't add multiple iframes in my CMS page from admin panel

6 June 2012 at 2:00pm
Thanks for the quick reply but it didn't worked with me. I added RAW in \themes\brett\templates\Page.ss as
<div id="Layout">
$Content.RAW
</div>BUT no change at all.
I will be thankful if you provide me a stepwise instruction to define a relation. I am a newbie in SilverStripe framework.
Thanks in advance
Sanjeev -
Re: Couldn't add multiple iframes in my CMS page from admin panel

6 June 2012 at 6:09pm
I think you would need to urldecode the source of your iframe. I tried to remove the special characters and replace them with their corresponding value and it worked just fine for me. Here's a link to a tutorial for relationship management in SS: http://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-management
| 362 Views | ||
|
Page:
1
|
Go to Top |


