Troubleshooting
Smarty/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:
Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
in /path/to/smarty/Smarty.class.php on line 1041
Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
in /path/to/smarty/Smarty.class.php on line 1041
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 occurred.
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.
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
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.
-
The
$template_diris incorrect, doesn't exist or the fileindex.tplis not in thetemplates/directory -
A
{config_load}function is within a template (orconfigLoad()has been called) and either$config_diris incorrect, does not exist orsite.confis not in the directory.
- Either the
$compile_diris incorrectly set, the directory does not exist, ortemplates_cis a file and not a directory.
- The
$compile_diris not writable by the web server. See the bottom of the installing smarty page for more about permissions.
- This means that
$cachingis enabled and either; the$cache_diris incorrectly set, the directory does not exist, orcache/is a file and not a directory.
- This means that
$cachingis enabled and the$cache_diris not writable by the web server. See the bottom of the installing smarty page for permissions.
Warning: filemtime(): stat failed for /path/to/smarty/cache/3ab50a623e65185c49bf17c63c90cc56070ea85c.one.tpl.php
in /path/to/smarty/libs/sysplugins/smarty_resource.php
- This means that your application registered a custom error handler
(using set_error_handler())
which is not respecting the given
$errnoas it should. If, for whatever reason, this is the desired behaviour of your custom error handler, please callmuteExpectedErrors()after you've registered your custom error handler.
See also debugging.