Salut,

Je voudrais générer du Json à partir de smarty. Cependant j'ai des problème du aux accolades et crochets...

Y'a-t-il une manière d'échapper les caractères spéciaux ?

Merci

voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
{"markers": [
	{foreach from=$listeEntites item=entite}
		{"lat":{$entite.lat}, "lng":{$entite.lng}, "tips": "{$entite.nom}","html":"<em>Le nom</em>{$entite.description"},
	{/foreach}
]}
Et l'erreur Smarty :
Fatal error: Smarty error: [in xxxx/retour_get_localisation.tpl line 1]: syntax error: unrecognized tag: "markers": [ {foreach from=$localisations item=entite (Smarty_Compiler.class.php, line 436) in xxxx/tools\smarty-2.6.9\Smarty.class.php on line 1088
(Comme vous pouvez le constater j'utilise la version 2.6.9 de smarty)