Hello!
I've written a PHP script that iterates over my database content that is saved in a smarty.tpl file, which is used to generates HTML pages.
The loop looks like this:
$smarty->force_compile = true;
$smarty->setCaching(Smarty::CACHING_OFF);
foreach($databaseRows as $key => $row) {
// Generate a temporary smarty.tpl file with the database content
file_put_contents("smarty.tpl", "{block name=content}{strip}" . $row . "{/strip}{/block}");
// Generate the final HTML file
file_put_contents("final-" . $key . ".html", $smarty->fetch("extends:foo.html|smarty.tpl", $url, time());
}
The generated files (final-123.html) are all the same, the contents of the very first database row. Since the fetch() function works fine the first time, but all subsequent calls do not read the newly generated smarty.tpl but the cached file from templates_c compile directory.
This problem appeared when I installed Smarty 5.8 (the previous version was 4.3.2).
I can temporarily avoid the problem by adding a random compile id to the fetch function.
Thank you.
Hello!
I've written a PHP script that iterates over my database content that is saved in a
smarty.tplfile, which is used to generates HTML pages.The loop looks like this:
The generated files (
final-123.html) are all the same, the contents of the very first database row. Since the fetch() function works fine the first time, but all subsequent calls do not read the newly generatedsmarty.tplbut the cached file fromtemplates_ccompile directory.This problem appeared when I installed Smarty 5.8 (the previous version was 4.3.2).
I can temporarily avoid the problem by adding a random compile id to the fetch function.
Thank you.