Page 1 sur 1

Problème avec Smarty

Posté : 24 nov. 2010, 13:34
par laresistance2
Bonjour,
J'ai un petit problème avec Smarty
Voici l'architecture du site
/Test/index.php
/Smarty/Smarty.class.php
/templates/TEST/test.tpl
/templates_c/

Code de index.php

Code : Tout sélectionner

<?php $moi = array ('moi', 'toi', 'nous'); require('../Smarty/Smarty.class.php'); $cmsTpl = new Smarty(); $cmsTpl->assign('LANG', $moi); $cmsTpl->display('test.tpl'); ?>
Par contre quand je déplace le fichier index.php dans la racine du site l'erreur ne s'affiche pas.
Voici l'erreur

Code : Tout sélectionner

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'TEST/test.tpl'' in /home/moi/Smarty/sysplugins/smarty_internal_template.php:162 Stack trace: #0 /home/moi/Smarty/sysplugins/smarty_internal_template.php(537): Smarty_Internal_Template->isExisting(true) #1 /home/moi/Smarty/Smarty.class.php(335): Smarty_Internal_Template->getRenderedTemplate() #2 /home/moi/Smarty/Smarty.class.php(379): Smarty->fetch('TEST/test.tpl', NULL, NULL, NULL, true) #3 /home/moi/Test/index.php(10): Smarty->display('TEST/test.tpl') #4 {main} thrown in /home/moi/Smarty/sysplugins/smarty_internal_template.php on line 162
Pouvez-vous m'aider ?
Merci

Re: Problème avec Smarty

Posté : 24 nov. 2010, 14:54
par xTG
Tu as une commande pour indiquer dans quel dossier se trouve les templates il me semble (de même pour le cache).
Car Smarty fonctionne avec une url basée sur ton index.php donc il a un dossier de décalage (il ne fait pas le retour en arrière que tu fais manuellement en incluant la classe).

Re: Problème avec Smarty

Posté : 24 nov. 2010, 18:09
par moogli
a tu testé : $cmsTpl->display('../templates/TEST/test.tpl'); ?

@+