Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Besoin d'aide pour résoudre mon erreur

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
laresistance2
Smarty Rookie


Joined: 29 Nov 2010
Posts: 23

PostPosted: Mon Dec 06, 2010 2:39 pm    Post subject: Besoin d'aide pour résoudre mon erreur Reply with quote

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 Wink
Back to top
View user's profile Send private message Visit poster's website
tison06
Smarty Rookie


Joined: 27 Nov 2010
Posts: 7
Location: Nice

PostPosted: Mon Dec 06, 2010 11:10 pm    Post subject: Reply with quote

Bonsoir, vérifie la valeur de ton cache
Code:
$cmsTpl->caching = 2;
Back to top
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Mon Dec 06, 2010 11:16 pm    Post subject: Reply with quote

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 Smile

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
View user's profile Send private message Send e-mail
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Mon Dec 06, 2010 11:22 pm    Post subject: Reply with quote

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' Smile

Lien de la doc : http://www.smarty.net/docs/en/api.is.cached.tpl

++
Back to top
View user's profile Send private message Send e-mail
laresistance2
Smarty Rookie


Joined: 29 Nov 2010
Posts: 23

PostPosted: Sat Dec 11, 2010 8:40 pm    Post subject: Reply with quote

Merci beaucoup !
Je vais essayer ça Wink
Oui en effet j'ai appris Smarty 2 et j'utilise la dernière version de Smarty (3.0.5)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP