Jump to content

Script/Style Tags on CMS pages - Prestashop 1.7.6


Recommended Posts

Hello PS community, 

I'm trying to add script/style tags via text editor but it keeps me throwing this error: "<p> <script>// <![CDATA[ alert(""); // ]]></script> </p>" is invalid." 

I did this in Prestashop 1.6 following Vekia's guide https://mypresta.eu/en/art/prestashop-16/extended-rich-text-editor.html - worked perfectly

For PS 1.7.6 I tried same guide for 1.7 but no success, it only extends text editor in product pages. *

Do you guys know any aproach to solve this problem ? 

 

* I know that he is doing a guide for 1.7.6 but in the meantime I need to get this working, I need to add custom javascript/css on CMS pages.

* Credits to Vekia. 

Thank you in advance. 

KR, 

Bruno

 

 

 

Link to comment
Share on other sites

1 hour ago, Rolige said:

Hello:

PS clean HTML content before save in CMS pages. You need to include your CSS lines on a CSS file of your theme (not inline) to get it work.

Regards

Hello Rolige, 

I solved it by using TinyMCE pro module from MYPresta, modifying isCleanHTML() function in classes/Validate.php isn't enough, I think PS uses something via JS before entering that function.

You need to include your CSS lines on a CSS file of your theme (not inline) to get it work.

-> Yes, I'm trying to do a workaround... I'd like to have specific css for each CMS page so I don't have to load it everytime I visit other pages on the site. 

Thank you for your answer.

 

KR,

Bruno

 

 

Link to comment
Share on other sites

Hi there,

 

As many other applications prestashop check html content and clean it...

BUT, only in back-office editors, if you are a sole editor of custom content you may use any html editor for your content and add it directly in mysql records of ps_cms_lang  

you will need to remove overwrite permission for prestashop user ( to prevent code cleaning if accidentally open for editing that pages in back-office editor) and always modify directly in DB record.

I used this method to add image maps in CMS pages and small css...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...