TroubleshootingSmarty/PHP errors
Smarty can catch many errors such as missing tag attributes
or malformed variable names. If this happens, you will see an error
similar to the following:
Smarty errors
Smarty shows you the template name, the line number and the error.
After that, the error consists of the actual line number in the Smarty
class that the error occured.
There are certain errors that Smarty cannot catch, such as missing
close tags. These types of errors usually end up in PHP compile-time
parsing errors.
PHP parsing errors
When you encounter a PHP parsing error, the error line number will
correspond to the compiled PHP script, not the template itself. Usually
you can look at the template and spot the syntax error. Here are some
common things to look for: missing close tags for
{if}{/if} or
{section}{/section},
or syntax of logic within an {if} tag. If you
can't find the error, you might have to open the compiled PHP file and
go to the line number to figure out where the corresponding error is in
the template.
Other common errors
The $template_dir
is incorrect, doesn't exist or
the file index.tpl is not in the
templates/ directory
A {config_load}
function is within a template (or
config_load()
has been called) and either
$config_dir
is incorrent , does not exist or
site.conf is not in the directory.
Either the
$compile_dir
is incorrectly set, the directory does not exist,
or templates_c is a
file and not a directory.
The $compile_dir
is not writable by the web server. See the bottom of the
installing smarty page
for permissions.
This means that
$caching is enabled and either;
the
$cache_dir
is incorrectly set, the directory does not exist,
or cache is a
file and not a directory.
This means that
$caching is enabled and the
$cache_dir
is not writable by the web server. See the bottom of the
installing smarty page
for permissions.
See also
debugging,
$error_reporting
and
trigger_error().