Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
bugs of function isCached on versions upper than 3.1.8

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
skyline
Smarty n00b


Joined: 25 Jun 2013
Posts: 2

PostPosted: Tue Jun 25, 2013 8:01 am    Post subject: bugs of function isCached on versions upper than 3.1.8 Reply with quote

Dear All,

I'm using smarty 3.1.13 on a demo project.

There are three php files:
index.php - in dir 'root_dir', to generate the cache file.
checkCache1.php - in dir 'root_dir'
checkCache2.php - in dir 'root_dir/admin'

Both of the two 'check' files have the same functionality - to check if the cache files generated by smarty exist by calling function isCached.
And I instantiate a smarty object in each file, which have the same configurations(templateDir, compileDir, configDir, cacheDir, etc).

Then strange things happen that the cache file can be detected by running checkCache1.php other than checkCache2.php. But the cache files can be clear if I call function clearCache in each file.

I have tested the versions from 3.1.8 to 3.1.13 and found that only version 3.1.8 works.

Can anyone help on this? Is it a bug in those versions upper than 3.1.8?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4688
Location: Hamburg / Germany

PostPosted: Tue Jun 25, 2013 9:38 am    Post subject: Reply with quote

how did you configure templateDir, compileDir, configDir, cacheDir in each of the php files?

How do the isCached() calls look like?
Back to top
View user's profile Send private message
skyline
Smarty n00b


Joined: 25 Jun 2013
Posts: 2

PostPosted: Tue Jun 25, 2013 9:59 am    Post subject: Reply with quote

U.Tews wrote:
how did you configure templateDir, compileDir, configDir, cacheDir in each of the php files?

How do the isCached() calls look like?


Here attached the source code in the two files:
Code:

<?php
require_once(DIR_ROOT.'/Smarty/libs/Smarty.class.php'); //DIR_ROOT is the root directory of the project

$smarty = new Smarty();
//var_dump($smarty);
$smarty->caching = true;
$smarty->setTemplateDir(DIR_ROOT.'/Smarty/templates');
$smarty->setCompileDir(DIR_ROOT.'/Smarty/templates_c');
$smarty->setConfigDir(DIR_ROOT.'/Smarty/configs');
$smarty->setCacheDir(DIR_ROOT.'/Smarty/cache');

$smarty->left_delimiter = "{#";
$smarty->right_delimiter = "#}";

$template_dir = $smarty->getTemplateDir();
var_dump($template_dir);

if ($smarty->isCached('index.tpl')) {
    echo "cache file exists!";
} else {
    echo "no cache file";
}

$smarty->clearCache('index.tpl');
//$smarty->clearAllCache();

?>
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4688
Location: Hamburg / Germany

PostPosted: Tue Jun 25, 2013 4:37 pm    Post subject: Reply with quote

I tested same configuration at my place.
The generated cache file is seen by both files
checkCache1.php - in dir 'root_dir' and
checkCache2.php - in dir 'root_dir/admin'

I have no idea what goes wrong at your place.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs 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