|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
laresistance2 Smarty Rookie
Joined: 29 Nov 2010 Posts: 23
|
Posted: Mon Dec 06, 2010 2:39 pm Post subject: Besoin d'aide pour résoudre mon erreur |
|
|
Bonjour,
J'ai une grosse erreur que je n'arrive pas à résoudre
Voici l'architecture du site
~/Moi/index.php
~/libs/Smarty
~/data/cache/cache_smarty
~/templates/TEST/test.tpl
~/templates_c/
Voici mon fichier ~/Moi/index.php
Code: | <?php
$page = 'test';
$tpl = 'TEST';
$lang = array ('moi', 'toi', 'nous');
define('moi', 'HELLO');
require(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'libs/Smarty/Smarty.class.php');
$cmsTpl = new Smarty();
$cmsTpl->template_dir = (dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'templates');
$cmsTpl->compile_dir = (dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'templates_c');
$cmsTpl->cache_dir = (dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'data/cache/cache_smarty');
$cmsTpl->caching = 2; // 0 = Cache désactivé | 1 = Cache activé | 2 = Définir la durée de cache | -1 = Cache qui n'expire jamais
$cmsTpl->cache_lifetime = 3600; // 3600 secondes = 1H : durée du cache
if ($cmsTpl->is_cached($tpl . DIRECTORY_SEPARATOR . $page . '.tpl')) {
/*Calcul des données et assignations */
$cmsTpl->assign('LANG', $lang);
}
$cmsTpl->display($tpl . DIRECTORY_SEPARATOR . $page . '.tpl');
|
Et voici l'erreur :
Code: | Notice: function call 'is_cached' is unknown or deprecated. in /home/MON_PC/www/libs/Smarty/sysplugins/smarty_internal_wrapper.php on line 57 Fatal error: Uncaught exception 'SmartyException' with message 'unknown method 'is_cached'' in /home/MON_PC/www/libs/Smarty/sysplugins/smarty_internal_wrapper.php:112 Stack trace: #0 /home/MON_PC/www/libs/Smarty/Smarty.class.php(757): Smarty_Internal_Wrapper->convert('is_cached', Array) #1 /home/MON_PC/www/MOI/index.php(14): Smarty->__call('is_cached', Array) #2 /home/MON_PC/www/MOI/index.php(14): Smarty->is_cached('TEST/test.tpl') #3 {main} thrown in /home/MON_PC/www/libs/Smarty/sysplugins/smarty_internal_wrapper.php on line 112 |
Avez-vous une idée de l'erreur ?
Merci d'avance |
|
Back to top |
|
tison06 Smarty Rookie
Joined: 27 Nov 2010 Posts: 7 Location: Nice
|
Posted: Mon Dec 06, 2010 11:10 pm Post subject: |
|
|
Bonsoir, vérifie la valeur de ton cache
Code: | $cmsTpl->caching = 2; |
|
|
Back to top |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Mon Dec 06, 2010 11:16 pm Post subject: |
|
|
Bonjour / bonsoir,
Cette erreur proviens de la ligne :
Code: |
if ($cmsTpl->is_cached($tpl . DIRECTORY_SEPARATOR . $page . '.tpl')) {
|
En effet il me semble qu'avec la version 3 de smarty, la fonction "is_cached" n'existe plus
En smarty 2 :
http://www.smarty.net/docsv2/en/api.is.cached.tpl
Qu'on ne retrouve pas dans la doc du smarty 3 (même apres un search dans eclipse, cela ne m'a rien donné) |
|
Back to top |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Mon Dec 06, 2010 11:22 pm Post subject: |
|
|
Oups autant pour moi, je viens de la trouver dans le fichier "sysplugins/Smarty_Internal_Template" ligne 339
Mais elle a changer de nom de 'is_cached' à 'isCached'
Lien de la doc : http://www.smarty.net/docs/en/api.is.cached.tpl
++ |
|
Back to top |
|
laresistance2 Smarty Rookie
Joined: 29 Nov 2010 Posts: 23
|
Posted: Sat Dec 11, 2010 8:40 pm Post subject: |
|
|
Merci beaucoup !
Je vais essayer ça
Oui en effet j'ai appris Smarty 2 et j'utilise la dernière version de Smarty (3.0.5) |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|