angrycat Posted September 9, 2013 Share Posted September 9, 2013 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. Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 check this thread: http://www.prestashop.com/forums/topic/271729-iframe-problem/ 1 Link to comment Share on other sites More sharing options...
angrycat Posted September 9, 2013 Author Share Posted September 9, 2013 Thanks vekia. But It's not working. "back office-->preferences-->general --> allow iframes in html= yes " This function is work only for product description. but in CMS page the iframe is still not allowed. 2 Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 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), 2 Link to comment Share on other sites More sharing options...
angrycat Posted September 9, 2013 Author Share Posted September 9, 2013 (edited) 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. 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. Edited September 9, 2013 by angrycat (see edit history) Link to comment Share on other sites More sharing options...
angrycat Posted September 9, 2013 Author Share Posted September 9, 2013 (edited) SolvedIn 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 September 10, 2013 by angrycat (see edit history) 10 Link to comment Share on other sites More sharing options...
vekia Posted September 10, 2013 Share Posted September 10, 2013 thanks for solution! it will be helpful for whole community im going to mark this topic as solved best regards Link to comment Share on other sites More sharing options...
flyclothing Posted September 30, 2013 Share Posted September 30, 2013 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. Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 have you switched "allow iframe" settings in preferences > general ? Link to comment Share on other sites More sharing options...
Bonjour Posted September 30, 2013 Share Posted September 30, 2013 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... 1 Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 take a look here: http://mypresta.eu/en/art/developer/prestashop-product-page-full-rich-editor.html#validate_class_change comment code mean that you have to use comment signs /* */ /* this is commented code and it will not be executed */ 1 Link to comment Share on other sites More sharing options...
Bonjour Posted September 30, 2013 Share Posted September 30, 2013 take a look here: http://mypresta.eu/en/art/developer/prestashop-product-page-full-rich-editor.html#validate_class_change comment code mean that you have to use comment signs /* */ /* this is commented code and it will not be executed */ Thanks, it works. Link to comment Share on other sites More sharing options...
flyclothing Posted September 30, 2013 Share Posted September 30, 2013 That worked perfectly. Thank you. Link to comment Share on other sites More sharing options...
flyclothing Posted October 3, 2013 Share Posted October 3, 2013 Vekia, Can you look at this post? My store is having other issues after chaning the validate.php code. http://www.prestashop.com/forums/topic/279096-validation-error-causing-data-not-to-save/?hl=%2Bcompilation+%2Bfailed Jonathan Link to comment Share on other sites More sharing options...
vekia Posted October 3, 2013 Share Posted October 3, 2013 hello, error that you've got now isn't related to the isCleanHtml function, it's a bit different issue Link to comment Share on other sites More sharing options...
flyclothing Posted October 3, 2013 Share Posted October 3, 2013 Any thoughts on a solution? We cant update any of our products or categories without this being fixed. Link to comment Share on other sites More sharing options...
NLeone Posted October 9, 2013 Share Posted October 9, 2013 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? Link to comment Share on other sites More sharing options...
ElangLiar Posted October 30, 2013 Share Posted October 30, 2013 Not work! for prestashop 1.5.5 any solution again? Link to comment Share on other sites More sharing options...
vekia Posted October 30, 2013 Share Posted October 30, 2013 Not work! for prestashop 1.5.5 any solution again? and what did you do ? which one suggestion you followed? Link to comment Share on other sites More sharing options...
barrym Posted November 6, 2013 Share Posted November 6, 2013 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, Link to comment Share on other sites More sharing options...
vekia Posted November 7, 2013 Share Posted November 7, 2013 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? Link to comment Share on other sites More sharing options...
barrym Posted November 7, 2013 Share Posted November 7, 2013 (edited) 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 November 7, 2013 by barrym (see edit history) Link to comment Share on other sites More sharing options...
barrym Posted November 7, 2013 Share Posted November 7, 2013 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. Link to comment Share on other sites More sharing options...
Prestafan1234 Posted December 4, 2013 Share Posted December 4, 2013 This is still an issue in version 1.5.6.1. Do I need to create a bug in order for it to be fixed in the next release? 1 Link to comment Share on other sites More sharing options...
vekia Posted December 4, 2013 Share Posted December 4, 2013 you have to allow iframes in preferences > general tab Link to comment Share on other sites More sharing options...
Prestafan1234 Posted December 4, 2013 Share Posted December 4, 2013 True vekia, but the wrong code is still in the file also. 1 Link to comment Share on other sites More sharing options...
Dennasz1 Posted January 7, 2014 Share Posted January 7, 2014 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 1 Link to comment Share on other sites More sharing options...
fulviods Posted February 3, 2014 Share Posted February 3, 2014 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 basicAnyone solved this problem? Link to comment Share on other sites More sharing options...
fulviods Posted February 3, 2014 Share Posted February 3, 2014 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 Link to comment Share on other sites More sharing options...
vekia Posted February 3, 2014 Share Posted February 3, 2014 so what code you're trying to use? can you show it here please? Link to comment Share on other sites More sharing options...
romedius33 Posted June 19, 2014 Share Posted June 19, 2014 sorry, but this iframe problem is still not solved. Even if you allow iframes and modify the validate.php. I try to implement a simple Google Maps iframe. Nothing special. Has anyone a solution? Link to comment Share on other sites More sharing options...
sjousse Posted June 20, 2014 Share Posted June 20, 2014 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 Link to comment Share on other sites More sharing options...
vekia Posted June 20, 2014 Share Posted June 20, 2014 it's worth to mention that everything depends on ps version there are differencies in the code between for example 1.5.2 and 1.6.0.6 etc 1 Link to comment Share on other sites More sharing options...
CmsFan Posted July 25, 2014 Share Posted July 25, 2014 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? Link to comment Share on other sites More sharing options...
vekia Posted July 26, 2014 Share Posted July 26, 2014 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" Link to comment Share on other sites More sharing options...
alexgreg Posted August 11, 2014 Share Posted August 11, 2014 Same problem Can't embed video mp4 to cms page PS1.6.0.9 did everything mentioned here . Any solution& Link to comment Share on other sites More sharing options...
vekia Posted August 12, 2014 Share Posted August 12, 2014 Same problem Can't embed video mp4 to cms page PS1.6.0.9 did everything mentioned here . Any solution& what code you use to embed it? Link to comment Share on other sites More sharing options...
CHEF Angélina Posted March 6, 2015 Share Posted March 6, 2015 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> Link to comment Share on other sites More sharing options...
HeyVoOn Posted April 26, 2015 Share Posted April 26, 2015 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; */ Link to comment Share on other sites More sharing options...
nikolaik Posted June 2, 2015 Share Posted June 2, 2015 PrestaShop™ 1.5.5.0 commenting this code perfectly solved the issue. Thanks for the solution. Link to comment Share on other sites More sharing options...
zoiijared Posted September 17, 2015 Share Posted September 17, 2015 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" Link to comment Share on other sites More sharing options...
Dovoda Posted October 14, 2015 Share Posted October 14, 2015 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. Link to comment Share on other sites More sharing options...
jdmstar Posted June 11, 2016 Share Posted June 11, 2016 (edited) 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 June 11, 2016 by jdmstar (see edit history) Link to comment Share on other sites More sharing options...
barrym Posted October 27, 2016 Share Posted October 27, 2016 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 Link to comment Share on other sites More sharing options...
SilviaPimenta Posted January 9, 2017 Share Posted January 9, 2017 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. 1 Link to comment Share on other sites More sharing options...
flyclothing Posted January 9, 2017 Share Posted January 9, 2017 As the title of this thread says, this fix is for 1.5.5. Probably 99.9% of the forum is going to be dedicated to 1.6 and below versions. Link to comment Share on other sites More sharing options...
smalltowngirl Posted March 1, 2017 Share Posted March 1, 2017 (edited) 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 March 1, 2017 by smalltowngirl (see edit history) Link to comment Share on other sites More sharing options...
mpouliot34 Posted June 19, 2017 Share Posted June 19, 2017 Thanks Vekia this worked fine Link to comment Share on other sites More sharing options...
Recommended Posts