[Smarty] Conflit entre jquery et smarty
Bonjour, j'ai un soucis pour utilisé du JQuery dans un template qui emplois du smarty.
Voici mon fichier .tpl :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <html>
<head>
<title>Test smarty</title>
<script src="http://www.jquery.info/scripts/jquery-1.0.1.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("a.load")
.click(function() {
$("#myid").load(this.href);
return false;
});
});
</script>
</head>
<body>
<a href="mapage_fragment.html" class="load" >voir tpl1</a><br />
<a href="mapage_fragment2.html" class="load" >voir tpl2</a><br />
<a href="mapage_fragment3.html" class="load" >voir tpl3</a><br />
<div id="myid" style="width:300; height:180; overflow:auto; border:solid 1px black;">
</div>
</body>
</html> |
Je n'ai pas mis le code entier, ms j'utilise des variables smarty comme dans cette exemple :
Code:
<li>un entier: <span style="color:red;">{$smarty_un_entier}</span></li>
Mon problème est que pour utilisé des variables en smarty on doit utilisé le caractère $ devant, et que dans mon script javascript je les emplois également, ce qui me genere cette erreur lors du chargement de la page :
Fatal error: Smarty error: [in index.tpl line 7]: syntax error: unrecognized tag: $("a.load") .click(function() { $("#myid").load(this.href); return false; (Smarty_Compiler.class.php, line 446) in C:\wamp\www\smarty\libs\Smarty.class.php on line 1092
Y a t'il une autre méthode pour contourner ce problème ou ne peut-on pas utilisé du jquery avec le smarty ??
merci
Cordialement, Nimo