Jump to content

[SOLVED] Can't add an iframe in CMS page (1.5.5)


Recommended Posts

When add an iframe in CMS page. An errer show  "The content field (English (United States)) is invalid."(Prestashop 1.5.5 clean install)

 

But in 1.5.4.1 is work fine. Is there anybody can solve this probem?

 

 

Best regards.

Share this post


Link to post
Share on other sites

okay, thanks for information, in last several days i've noticed many posts related to this issue and in some of them this helped.

 

anyway, can you use this: extend tinymce options

 

+ make sure that you've got in class/cms.php in object definition this code:

'content' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 3999999999999),

  • Like 2

Share this post


Link to post
Share on other sites

Many thanks for fast reply vekia.

 

I've try TinyMCE editor and checked in class/cms.php

but in CMS page the iframe is still not allowed. :D

Look like prestashop 1.5.5 system is not allowed iframe in to the cms database table.

 

But It's ok. I'll roll back to 1.5.4.1 temporary.

post-604437-0-47129800-1378743897_thumb.jpg

Edited by angrycat (see edit history)

Share this post


Link to post
Share on other sites

Solved

In prestashop\classes\Validate.php

line 392  At 

public static function isCleanHtml($html, $allow_iframe = false)
 

comment out this code

/*
        if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
            return false;

        if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
            return false;
*/
Edited by angrycat (see edit history)
  • Like 10

Share this post


Link to post
Share on other sites

  • 3 weeks later...

I am trying to embed a video in the page content of the CMS page and it seems to be having the same issue.  It wont work and gives me this error at the top of the page: The content field (English (United States)) is invalid.  I am using 1.5.5.0 I have the iframe option turned on under the general options.

Share this post


Link to post
Share on other sites

 

Solved

 

In prestashop\classes\Validate.php

line 392  At 

 

public static function isCleanHtml($html, $allow_iframe = false)

 

comment out this code

/*
        if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
            return false;

        if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
            return false;
*/

What do you mean with '' comment out this code '' 

and what do you changed in this row?

 

Same problem over here...

  • Like 1

Share this post


Link to post
Share on other sites

Thanks! Your solve of commenting out works, but has resulted in an annoying bug:

Every time I save the page with a Youtube movie, it links to a blank white page. It updates it, but somehow doesn't go back to the original menu.

 

Any thoughts on this issue?

Share this post


Link to post
Share on other sites

  • 3 weeks later...

I am running my shop on an older version of prestashop Version 1.3.2.3

I am having trouble adding an iframe to the CMS page. Can some please help show me how to modify the CMS page to ignore or restore the iframe tag...? 

 

Thank you,

Share this post


Link to post
Share on other sites

hello

 

you use a bit old ps version, all tutorials here will not work for you.

Please describe what kind of problems you've got in your 1.3.x version while you're trying to add iframe to cms page

some error messages?

Share this post


Link to post
Share on other sites

When I try saving the iframe code in the html source editor it comes back blank after saving/updating.

 

The editor wont recognize the iframe code...? Is there a way around this? Please walk me through the steps and code that needs to be editor in order to allow iframe on CMS pages with my old prestashop version 1.3.2.3.

 

Thanks you for your help.

Edited by barrym (see edit history)

Share this post


Link to post
Share on other sites

The editor wont recognize the iframe code...? Is there a way around this? Please walk me through the steps and code that needs to be editor in order to allow iframe on CMS pages with my old prestashop version 1.3.2.3.

 

Thanks you for your help.

Share this post


Link to post
Share on other sites

  • 4 weeks later...
  • 1 month later...

Hello,

 

I still got the same issue on 1.5.6.1

 

Should iscleanhtml part look like this now?

 

public static function isCleanHtml($html, $allow_iframe = false)
{
return true;
}
/*
        if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
            return false;
 
        if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
            return false;
*/
 
 
Thanks in advance
  • Like 1

Share this post


Link to post
Share on other sites

  • 4 weeks later...

I also have the problem on 1.5.6.1! I have html/javascript code in some cms pages to show a slideshow and nothing work now :(

 

i allowd iframes, i modified validate.php ... but nothing work....

So stupid that we have to fight to do something so basic

Anyone solved this problem?

 

Share this post


Link to post
Share on other sites

ok i frames seem to work but not other code... i used to have in my cms page some code (this one http://www.prestashop.com/forums/topic/301213-js-script-for-adding-slideshow-anywhere-you-need/?p=1548708) to have a slideshow but impossible to make it work....

 

I followed also this link http://mypresta.eu/en/art/know-how/tinymce-editor-full-options-all-html-tags.html

Share this post


Link to post
Share on other sites

  • 4 months later...

To all, instead of directly edit "/classes/Validate.php", you should add an override in "/override/classes".

 

Get the attached file and copy it in "/override/classes/" folder.

Then, delete the override cache file "/cache/class_index.php".

 

This is the same modification from Angrycat but in a more clean way.

 

Beware of this manipulation : you'll disable the "allow iframe" option in "Admin > General". Iframe will be allowed in all content "protected" by "Validate::isCleanHtml()" even if you disable it in the "Admin > General" tab.

Validate.php

Share this post


Link to post
Share on other sites

  • 1 month later...

Hi there. I have a similar problem, but the issue is the following:

 

I enabled Iframes on Prestashop 1.6 and html ones work perfect.

 

Hatowever, when I try to insert a javascript iframe, system doesn't allow this. The fact is that I want to insert a booking search engine iframe. The code of the search box is as follow:

 

<script language='Javascript' src='http://www.bookhostels.com/files/index.php?UserID=zzzzzzzzzzzzzz&File=bighw&Language=Spanish&Currency=EUR&NewWindow=0&PropTypeSelect=1'></script>

 

How can I insert this little javascript code as an iframe into a Cms Prestashop page?

Share this post


Link to post
Share on other sites

prestashop tinymce editor by default doesnt allow to use <script> tags.

in this case it's necessary to extend it

here on forum you can find several solutions related to "extending tinymce in 1.6"

Share this post


Link to post
Share on other sites

  • 3 weeks later...
  • 6 months later...

Bonjour,

 

Je voudrais insérer ce code sur une de mes pages CMS comment puis-je faire SVP ? : <script type="text/javascript" src="http://services.supportduweb.com/comments/12040.js"></script><a href="http://www.supportduweb.com/service-module-commentaires-gratuit-messages-visiteurs-module-script-systeme-commentaires-gratuit.html">Module de Commentaires</a>

Share this post


Link to post
Share on other sites

  • 1 month later...

I have version 1.6.0.14 and this problem still has not been fixed! 

 

I was able to fix commenting the code; (Validate.php)

 

/*
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
return false;
 
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
return false;
*/

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...

HELP ME... my web ERROR

 

 

Parse error: syntax error, unexpected 'if' (T_IF), expecting ';' or '{' in /home/murahbin/public_html/classes/Validate.php on line 399

 

 

 

www.murahbingits.com

 

 

 

after I followed what was said "angrycat"
 

Share this post


Link to post
Share on other sites

  • 4 weeks later...

Using PS 1.4.0.17

 

Same problem here, when adding <iframe> code in HTML, after saving the HTML field is blanc. It doesn't save the <iframe> code. It does save an other random HTML code.

 

In Preferences there is no option for able/disable iframes.

 

My codes in Validate.php look different then examples mentioned in this topic before.

 

Thanks for your help.

Share this post


Link to post
Share on other sites

  • 7 months later...

Hope im not digging up an old thread but this is rather easy to fix. Just open up phpMYadmin and expand your prestashop database. Mine would be labeled as "pr." Inside that is a lot of tables called ps_

 

Look for: ps_cms_lang

 

And all your CMS pages will load. Click on edit on the page you want to add the HTML code to. Paste in the code to the big box at the bottom. And then when your done scroll down and make sure save is selected from the drop down menu and click on go.

 

Viola you just bypassed prestashop

 

Thank me later

Edited by jdmstar (see edit history)

Share this post


Link to post
Share on other sites

  • 4 months later...

Hello,


 


I had a custom theme created many years ago on version 1.3.2.3 


I am trying to allow iframe in CMS pages but I am unable to.


These is no option in preferences to allow iframe and I dont see anywhere in validate.php the iframe.


This is what i see:


 


static public function isCleanHtml($html)

{

$jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave';

return (!preg_match('/<[ \t\n]*script/ui', $html) && !preg_match('/<.*('.$jsEvent.')[ \t\n]*=/ui', $html)  && !preg_match('/.*script\:/ui', $html));

}

 

 

Can someone please help me out to get the iframe going?

 

Thanks,

 

Barry

Share this post


Link to post
Share on other sites

  • 2 months later...

Good afternoon, I tried everything you said and even then I can not insert my youtube video into my CMS page. I would like a little help. I am using prestashop version 1.7. I apologize for my English.

Good afternoon, I tried everything you said and even then I can not insert my youtube video into my CMS page. I would like a little help. I am using prestashop version 1.7. I apologize for my English.

  • Like 1

Share this post


Link to post
Share on other sites

  • 1 month later...

Hello,

i cannot find "enable iframe" option in the administration/preferences/general tab.

im using prestashop 1.5.3.1

 

There are only 4 options available in it.

1. Automatically check for module updates

2. Check IP on the cookie

3. Lifetime of the Front Office cookie

4. Lifetime of the back Office cookie

 

I want to add a virtual reality image onto my contact us page of our website.  

Edited by smalltowngirl (see edit history)

Share this post


Link to post
Share on other sites

  • 3 months later...
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More