Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 3ca7e0e5486da714e98ac79af09ca745 > files > 123

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 16. Extending Smarty With Plugins</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Smarty Manual">
<link rel="up" href="smarty.for.programmers.html" title="Part III. Smarty For Programmers">
<link rel="prev" href="template.resources.html" title="Resources">
<link rel="next" href="plugins.naming.conventions.html" title="Naming Conventions">
</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 16. Extending Smarty With Plugins</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="template.resources.html">Prev</a> </td>
<th width="60%" align="center">Part III. Smarty For Programmers</th>
<td width="20%" align="right"> <a accesskey="n" href="plugins.naming.conventions.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter" title="Chapter 16. Extending Smarty With Plugins">
<div class="titlepage"><div><div><h2 class="title">
<a name="plugins"></a>Chapter 16. Extending Smarty With Plugins</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="sect1"><a href="plugins.html#plugins.howto">How Plugins Work</a></span></dt>
<dt><span class="sect1"><a href="plugins.naming.conventions.html">Naming Conventions</a></span></dt>
<dt><span class="sect1"><a href="plugins.writing.html">Writing Plugins</a></span></dt>
<dt><span class="sect1"><a href="plugins.functions.html">Template Functions</a></span></dt>
<dt><span class="sect1"><a href="plugins.modifiers.html">Modifiers</a></span></dt>
<dt><span class="sect1"><a href="plugins.block.functions.html">Block Functions</a></span></dt>
<dt><span class="sect1"><a href="plugins.compiler.functions.html">Compiler Functions</a></span></dt>
<dt><span class="sect1"><a href="plugins.prefilters.postfilters.html">Prefilters/Postfilters</a></span></dt>
<dt><span class="sect1"><a href="plugins.outputfilters.html">Output Filters</a></span></dt>
<dt><span class="sect1"><a href="plugins.resources.html">Resources</a></span></dt>
<dt><span class="sect1"><a href="plugins.inserts.html">Inserts</a></span></dt>
</dl>
</div>
<p>
   Version 2.0 introduced the plugin architecture that is used
   for almost all the customizable functionality of Smarty. This includes:
   </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc" compact>
<li class="listitem">functions</li>
<li class="listitem">modifiers</li>
<li class="listitem">block functions</li>
<li class="listitem">compiler functions</li>
<li class="listitem">prefilters</li>
<li class="listitem">postfilters</li>
<li class="listitem">outputfilters</li>
<li class="listitem">resources</li>
<li class="listitem">inserts</li>
</ul></div>
<p>
   With the exception of resources, backwards compatibility with the old
   way of registering handler functions via register_* API is preserved. If
   you did not use the API but instead modified the class variables
   <code class="literal">$custom_funcs</code>, <code class="literal">$custom_mods</code>, and
   other ones directly, then you will need to adjust your scripts to either
   use the API or convert your custom functionality into plugins.
  </p>
<div class="sect1" title="How Plugins Work">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="plugins.howto"></a>How Plugins Work</h2></div></div></div>
<p>
    Plugins are always loaded on demand. Only the specific modifiers,
    functions, resources, etc invoked in the templates scripts will be
    loaded. Moreover, each plugin is loaded only once, even if you have
    several different instances of Smarty running within the same request.
   </p>
<p>
    Pre/postfilters and output filters are a bit of a special case. Since
    they are not mentioned in the templates, they must be registered or
    loaded explicitly via API functions before the template is processed.
    The order in which multiple filters of the same type are executed
    depends on the order in which they are registered or loaded.
   </p>
<p>
    The <a class="link" href="variable.plugins.dir.html" title="$plugins_dir">plugins directory</a>
    can be a string containing a path or an array containing multiple
    paths. To install a plugin, simply place it in one of the
    directories and Smarty will use it automatically.
   </p>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="template.resources.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="smarty.for.programmers.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="plugins.naming.conventions.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Resources </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Naming Conventions</td>
</tr>
</table>
</div>
</body>
</html>