0 byte compiled templates
| From: | Marc Logemann | Date: | Fri, 28 Dec 2001 12:51:53 +0000 |
| Subject: | 0 byte compiled templates | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2400@lists.php.net to get a copy of this message | ||
Hi,
sometimes i have 0 bytes compiled templates in my templates_c
directory. (not directly in templates_c of course...you know...)
So when users request this template, smarty looks for the timestamp
of the compiled template and if not changed return the compiled
template to the user.
The problem is, a 0 byte template results in a blank screen of course.
The problem: i dont know why there are sometimes 0 byte files.
Possible solution:
it would be nice if smarty would recompile if there is a 0bytes file
whether or not the timestamp is correct.
Your code:
function _fetch_compiled_template_timestamp($include_path)
{
// everything is in $compile_dir
return filemtime($include_path);
}
what about something like this:
function _fetch_compiled_template_timestamp($include_path)
{
// everything is in $compile_dir
if(compiled_file != 0bytes)
return filemtime($include_path);
else
return 0;
}
This way the template will recompile when it is 0 bytes.
Its only a very quick workaround, i know it would be better
to tackle the problem on its root (why there are 0 bytes files).