mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
more linking :-)
This commit is contained in:
@@ -3,19 +3,23 @@
|
||||
<sect1 id="advanced.features.outputfilters">
|
||||
<title>Output Filters</title>
|
||||
<para>
|
||||
When the template is invoked via display() or fetch(), its output can be
|
||||
sent through one or more output filters. This differs from postfilters
|
||||
When the template is invoked via
|
||||
<link linkend="api.display">display()</link> or
|
||||
<link linkend="api.fetch">fetch()</link>, its output can be
|
||||
sent through one or more output filters. This differs from
|
||||
<link linkend="advanced.features.postfilters">postfilters</link>
|
||||
because postfilters operate on compiled templates before they are saved to
|
||||
the disk, and output filters operate on the template output when it is
|
||||
the disk, wheras output filters operate on the template output when it is
|
||||
executed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Output filters can be either
|
||||
<link linkend="api.register.outputfilter">registered</link> or loaded
|
||||
from the plugins directory by using
|
||||
from the
|
||||
<link linkend="variable.plugins.dir">plugins directory</link> by using the
|
||||
<link linkend="api.load.filter">load_filter()</link> function or by
|
||||
setting
|
||||
setting the
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
variable. Smarty will pass the template output as the first argument,
|
||||
and expect the function to return the result of the processing.
|
||||
@@ -35,8 +39,8 @@ function protect_email($tpl_output, &$smarty)
|
||||
}
|
||||
|
||||
// register the outputfilter
|
||||
$smarty->register_outputfilter("protect_email");
|
||||
$smarty->display("index.tpl");
|
||||
$smarty->register_outputfilter('protect_email');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
// now any occurrence of an email address in the template output will have
|
||||
// a simple protection against spambots
|
||||
@@ -44,6 +48,14 @@ $smarty->display("index.tpl");
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.outputfilter">register_outpurfilter()</link>,
|
||||
<link linkend="api.load.filter">load_filter()</link>,
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
<link linkend="advanced.features.postfilters">postfilters</link> and
|
||||
<link linkend="variable.plugins.dir">plugins directory</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
Reference in New Issue
Block a user