Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 3ca7e0e5486da714e98ac79af09ca745 > files > 145

php-smarty2-doc-2.6.28-2.mga4.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 17. Troubleshooting</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Smarty Manual">
<link rel="up" href="appendixes.html" title="Part IV. Appendixes">
<link rel="prev" href="appendixes.html" title="Part IV. Appendixes">
<link rel="next" href="tips.html" title="Chapter 18. Tips &amp; Tricks">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 17. Troubleshooting</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="appendixes.html">Prev</a> </td>
<th width="60%" align="center">Part IV. Appendixes</th>
<td width="20%" align="right"> <a accesskey="n" href="tips.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter" title="Chapter 17. Troubleshooting">
<div class="titlepage"><div><div><h2 class="title">
<a name="troubleshooting"></a>Chapter 17. Troubleshooting</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl><dt><span class="sect1"><a href="troubleshooting.html#smarty.php.errors">Smarty/PHP errors</a></span></dt></dl>
</div>
<p></p>
<div class="sect1" title="Smarty/PHP errors">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="smarty.php.errors"></a>Smarty/PHP errors</h2></div></div></div>
<p>
    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:
   </p>
<div class="example">
<a name="id3129598"></a><p class="title"><b>Example 17.1. Smarty errors</b></p>
<div class="example-contents"><pre class="screen">

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

    </pre></div>
</div>
<br class="example-break"><p>
    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.
   </p>
<p>
    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.
   </p>
<div class="example">
<a name="id3129671"></a><p class="title"><b>Example 17.2. PHP parsing errors</b></p>
<div class="example-contents"><pre class="screen">

Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75

    </pre></div>
</div>
<br class="example-break"><p>
    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
    <a class="link" href="language.function.if.html" title="{if},{elseif},{else}"><code class="varname">{if}{/if}</code></a> or
    <a class="link" href="language.function.if.html" title="{if},{elseif},{else}"><code class="varname">{section}{/section}</code>
    </a>, or syntax of logic within an <code class="varname">{if}</code> 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.
   </p>
<div class="example">
<a name="id3129720"></a><p class="title"><b>Example 17.3. Other common errors</b></p>
<div class="example-contents">
<pre class="screen">

Warning: Smarty error: unable to read resource: "index.tpl" in...
or
Warning: Smarty error: unable to read resource: "site.conf" in...

</pre>
<p>
    </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
      The <a class="link" href="api.variables.html#variable.template.dir" title="$template_dir">
      <em class="parameter"><code>$template_dir</code></em></a> is incorrect, doesn't exist or
      the file <code class="filename">index.tpl</code> is not in the
      <code class="filename">templates/</code> directory
      </p></li>
<li class="listitem"><p>
        A <a class="link" href="language.function.config.load.html" title="{config_load}">
        <code class="varname">{config_load}</code></a>
        function is within a template (or
        <a class="link" href="api.config.load.html" title="config_load()"><code class="varname">config_load()</code></a>
        has been called) and either
        <a class="link" href="variable.config.dir.html" title="$config_dir"><em class="parameter"><code>$config_dir</code></em>
        </a>  is incorrect, does not exist or
        <code class="filename">site.conf</code> is not in the directory.
        </p></li>
</ul></div>
<p>
    </p>
<pre class="screen">

Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist,
or is not a directory...

    </pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
    Either the
    <a class="link" href="variable.compile.dir.html" title="$compile_dir">
    <em class="parameter"><code>$compile_dir</code></em></a>is incorrectly set,
    the directory does not exist, or <code class="filename">templates_c</code> is a
    file and not a directory.
    </p></li></ul></div>
<pre class="screen">

Fatal error: Smarty error: unable to write to $compile_dir '....

    </pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
    The <a class="link" href="variable.compile.dir.html" title="$compile_dir">
   <em class="parameter"><code>$compile_dir</code></em></a> is not writable by the web server.
   See the bottom of the
    <a class="link" href="installing.smarty.basic.html" title="Basic Installation">installing smarty</a> page
    for more about permissions.
    </p></li></ul></div>
<pre class="screen">

Fatal error: Smarty error: the $cache_dir 'cache' does not exist,
or is not a directory. in /..

    </pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
    This means that
    <a class="link" href="variable.caching.html" title="$caching">
    <em class="parameter"><code>$caching</code></em></a> is enabled and either;
    the
    <a class="link" href="variable.cache.dir.html" title="$cache_dir"><em class="parameter"><code>$cache_dir</code></em></a>
    is incorrectly set, the directory does not exist,
    or <code class="filename">cache/</code> is a
    file and not a directory.
    </p></li></ul></div>
<pre class="screen">

Fatal error: Smarty error: unable to write to $cache_dir '/...

    </pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
    This means that
    <a class="link" href="variable.caching.html" title="$caching"><em class="parameter"><code>$caching</code></em></a> is
    enabled and the <a class="link" href="variable.cache.dir.html" title="$cache_dir">
    <em class="parameter"><code>$cache_dir</code></em></a>
    is not writable by the web server. See the bottom of the
    <a class="link" href="installing.smarty.basic.html" title="Basic Installation">installing smarty</a> page
    for permissions.
    </p></li></ul></div>
</div>
</div>
<br class="example-break"><p>
   See also
   <a class="link" href="chapter.debugging.console.html" title="Chapter 10. Debugging Console">debugging</a>,
   <a class="link" href="variable.error.reporting.html" title="$error_reporting">
   <em class="parameter"><code>$error_reporting</code></em></a>
   and
   <a class="link" href="api.trigger.error.html" title="trigger_error()"><code class="varname">trigger_error()</code></a>.
   </p>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="appendixes.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="appendixes.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="tips.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Part IV. Appendixes </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Chapter 18. Tips &amp; Tricks</td>
</tr>
</table>
</div>
</body>
</html>