Location: PHPKode > projects > SithTemplate > SithTemplate-1.1/docs/html/02_settings_8php-example.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SithTemplate: 02_settings.php</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<h1>02_settings.php</h1>  </div>
</div>
<div class="contents">
<p>An example showing how to change default library settings.</p>
<div class="fragment"><pre class="fragment">&lt;?php
require_once <span class="stringliteral">&#39;SithTemplate.php&#39;</span>;

<span class="comment">// You can change default settings during TemplateEnviron construction,</span>
<span class="comment">// by passing associative array to the constructor.</span>
$environ = <span class="keyword">new</span> <a name="_a0"></a><a class="code" href="class_template_environ.html" title="Template environment - library&amp;#39;s end-user API.">TemplateEnviron</a>(array(
 <span class="stringliteral">&#39;inputPrefix&#39;</span>  =&gt; <span class="stringliteral">&#39;./templates/&#39;</span>,
 <span class="stringliteral">&#39;outputPrefix&#39;</span> =&gt; <span class="stringliteral">&#39;./templates_c/&#39;</span>,
));

<span class="comment">// You can also load settings from INI file, using static named constructor</span>
<span class="comment">// See sample-configuration.ini for syntax.</span>
$environ = <a name="a1"></a><a class="code" href="class_template_environ.html#a9b30f6017bfdf15e9c0234d52ecf5a8d" title="Named constructor.">TemplateEnviron::createFromINI</a>(<span class="stringliteral">&#39;settings.ini&#39;</span>);

<span class="comment">// Finally, you can change settings in runtime, by modifying settings</span>
<span class="comment">// array directly. Note that some settings won&#39;t take effect if changed</span>
<span class="comment">// in that way. Refer to documentation for more information.</span>
$environ-&gt;settings[<span class="stringliteral">&#39;recompilationMode&#39;</span>] = <a name="a2"></a><a class="code" href="class_template_environ.html#a5b9029c41ea8dec7765f56b762a349d5" title="One of recompilation modes - always recompile.">TemplateEnviron::RECOMPILE_ALWAYS</a>;
</pre></div> </div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Fri Jan 14 2011 20:08:36 for SithTemplate by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
Return current item: SithTemplate