Difficulté avec Smarty
guilod
Messages postés
2
Statut
Membre
-
anonyme -
anonyme -
Bonjour,
voici comment j'ai procedé à l'installation de smarty dans mon serveur wamp:
1-j'ai d'abord téléchargé Smarty2.6.22 puis decompressé dans le repertoire wamp
2-ensuite j'ai renommé Smarty2.6.22 en smarty puis j'ai copié le dossier demo contenu dans smarty dans www qui est la racine de mon serveur.
3-dans php.ini, j'ai modifié le chemin include_path par include_path".;:/wamp/smarty
4-j'ai edité le fichier c:/wamp/www/demo/index.php et remplacé require '../libs/Smarty.class.php'; par
require 'Smarty.class.php';
5-en tapant l'URL suivant:http://127.0.0.1/demo/index.php deux erreurs surviennent
pouvez vous m'aider s'il vous plait.
Cordialement
voici comment j'ai procedé à l'installation de smarty dans mon serveur wamp:
1-j'ai d'abord téléchargé Smarty2.6.22 puis decompressé dans le repertoire wamp
2-ensuite j'ai renommé Smarty2.6.22 en smarty puis j'ai copié le dossier demo contenu dans smarty dans www qui est la racine de mon serveur.
3-dans php.ini, j'ai modifié le chemin include_path par include_path".;:/wamp/smarty
4-j'ai edité le fichier c:/wamp/www/demo/index.php et remplacé require '../libs/Smarty.class.php'; par
require 'Smarty.class.php';
5-en tapant l'URL suivant:http://127.0.0.1/demo/index.php deux erreurs surviennent
pouvez vous m'aider s'il vous plait.
Cordialement
A voir également:
- Difficulté avec Smarty
- Smarty uninstaller - Télécharger - Nettoyage
2 réponses
Bonjour,
voici mon index.php :
require_once "\wamp\www\lib\smarty\libs\Smarty.class.php";
$smartP = new Smarty();
$smartP->assign('hello_world','Bonjour les gens');
$mon_tableau_indexe = array("Jean-Luc","Jean","Sylvain","Eric");
$smartP->assign("smarty_mon_tableau_indexe", $mon_tableau_indexe);
$smartP->display('test4.tpl');
mon test4.tpl :
<h1>{$hello_world}</h1>
<p>ceci est une accolade : {literal}{{/literal}</p>
1er poste du tableau :
{smarty_mon_tableau_indexe[0]}
mon message d'erreur :
Fatal error: Smarty: [in test4.tpl line 11]: syntax error: unrecognized tag: smarty_mon_tableau_indexe[0] (Smarty_Compiler.class.php, line 416) in E:\wamp\www\lib\smarty\libs\Smarty_Compiler.class.php on line 2096
la ligne 11 c'est :
{smarty_mon_tableau_indexe[0]}
mon h1 s'affiche bien avec la bonne valeur ainsi que mon accolade protégée.
je ne vois pas l'erreur
voici mon index.php :
require_once "\wamp\www\lib\smarty\libs\Smarty.class.php";
$smartP = new Smarty();
$smartP->assign('hello_world','Bonjour les gens');
$mon_tableau_indexe = array("Jean-Luc","Jean","Sylvain","Eric");
$smartP->assign("smarty_mon_tableau_indexe", $mon_tableau_indexe);
$smartP->display('test4.tpl');
mon test4.tpl :
<h1>{$hello_world}</h1>
<p>ceci est une accolade : {literal}{{/literal}</p>
1er poste du tableau :
{smarty_mon_tableau_indexe[0]}
mon message d'erreur :
Fatal error: Smarty: [in test4.tpl line 11]: syntax error: unrecognized tag: smarty_mon_tableau_indexe[0] (Smarty_Compiler.class.php, line 416) in E:\wamp\www\lib\smarty\libs\Smarty_Compiler.class.php on line 2096
la ligne 11 c'est :
{smarty_mon_tableau_indexe[0]}
mon h1 s'affiche bien avec la bonne valeur ainsi que mon accolade protégée.
je ne vois pas l'erreur