21293 Posts in 5733 Topics by 2602 members
| Go to End | ||
| Author | Topic: | 3569 Views |
-
Re: SS Removing Closing <iframe> Tag From TextField

27 November 2010 at 8:47am
maybe place some code in the Page onbeforewrite that does a search replace to enter the space on $this->MyHTMLText
-
Re: SS Removing Closing <iframe> Tag From TextField

30 November 2010 at 12:23pm
Thanks, but that's not ideal because the code will vary depending on each video setting, and obviously I can't do a find & replace just on a self closing tag or it would affect other code.
-
Re: SS Removing Closing <iframe> Tag From TextField

30 November 2010 at 9:31pm
I'm not recommending a blanket acceptance of self closing tags - a regular expression matching something like "<iframe*vimeo*></iframe>" and you'd be able to identify the specific self-closing tags that you want to keep.
-
Re: SS Removing Closing <iframe> Tag From TextField

30 November 2010 at 11:42pm
Ah, I misunderstood. That works a treat, thanks!
function onBeforeWrite() {
$this->VimeoCode1 = str_replace("></iframe>", "> </iframe>", $this->VimeoCode1);
parent::onBeforeWrite();
} -
Re: SS Removing Closing <iframe> Tag From TextField

9 May 2011 at 11:19am
I've found that doing this:
function onBeforeWrite() {
$this->Content = str_replace("></iframe>", "> </iframe>", $this->Content);
parent::onBeforeWrite();
}doesn't work because the content has already been loaded into the object using domdocument so it's already collapsed the iframe. I've used this regexp instead:
function onBeforeWrite() {
$this->Content = preg_replace('|<iframe(.*)/>|Uims', '<iframe\\1> </iframe>', $this->Content);
parent::onBeforeWrite();
} -
Re: SS Removing Closing <iframe> Tag From TextField

22 November 2011 at 7:27am Last edited: 22 November 2011 7:46am
I just want to confirm Chris' solution works, thanks!Spoke too soon, didn't help. Instead I'm just putting an ' ' inside the iframe tags...not a great solution.
-
Re: SS Removing Closing <iframe> Tag From TextField

3 August 2012 at 3:43am
If someone's still having the same problem: I tried Chris's solution with ttyl's input - didn't work. It still removes the closing tag.
What did it for me (2.4.7) was the post from dendeffe on Page 1 of this thread.
Change the field form a HTMLText to a Text and use $myfield.RAW in the template. That's it.
| 3569 Views | ||
| Go to Top |




