Jump to content

insert javascript on CMS page


Recommended Posts

  • 3 months later...

It works perfect for me on the version 1.4.10.
Thanks Vekia !
 

Here is what is necessary (for Below v1.5.5) :

public static function isCleanHtml($html){
// We comment the following lines to prevent the check of the content
/*
        $events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange';
        $events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend';
        $events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove';
        $events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel';
        $events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart';
        $events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange';
        $events .= '|onselectstart|onstart|onstop';
        return (!preg_match('/<[ \t\n]*script/ims', $html) && !preg_match('/('.$events.')[ \t\n]*=/ims', $html) && !preg_match('/.*script\:/ims', $html));
*/
        return $html; // We add this line to return at least the original parameter
}

For more recent versions ( from Prestashop v1.5.5) please see the link Vekia posted.

Link to comment
Share on other sites

  • 4 months later...

thanks Vekia

 

I have done that, but I want to run ajax from other site it is not working

 

it calls

 

xmlhttp.open("GET","http://qyntra.in/getpin.php?q="+str,true);

 

<?php

 

$q = intval($_GET['q']);

$con = mysqli_connect('localhost','xxx','xxx','xxx');
if (!$con) {
  die('Could not connect: ' . mysqli_error($con));
}


mysqli_select_db($con,"chatport_qyntra");


$sql="SELECT * FROM fedex WHERE pin_code = "."$q";
$result = mysqli_query($con,$sql);

echo "<table border='0'>";


while($row = mysqli_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['cod'] . "</td>";
 
  echo "</tr>";
}

echo "</table>";

mysqli_close($con);
?>

 

 

please help me

Link to comment
Share on other sites

  • 1 month later...

 

follow part related to "Validate.php" file, nothing more

 

Hi Vekia, do you already have a solution for embedding code in v1.6?

I have followed your post above and changed the Validate.php, but I only ever end up with an empty <p></p> tag instead of the code...

 

Thanks for your help!

 

 

Cheers

Clemens

Link to comment
Share on other sites

Hi Vekia, do you already have a solution for embedding code in v1.6?

I have followed your post above and changed the Validate.php, but I only ever end up with an empty <p></p> tag instead of the code...

 

Thanks for your help!

 

 

Cheers

Clemens

 

here it is, especially for 1.6:

http://www.prestashop.com/forums/topic/318425-tutorial-tinymce-rich-text-editor-extended-version/

  • Like 2
Link to comment
Share on other sites

  • 7 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>

 

Link to comment
Share on other sites

×
×
  • Create New...