mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
add links
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
Template postfilters are PHP functions that your templates are ran through
|
Template postfilters are PHP functions that your templates are ran through
|
||||||
after they are compiled. Postfilters can be either
|
after they are compiled. Postfilters can be either
|
||||||
<link linkend="api.register.postfilter">registered</link> or loaded
|
<link linkend="api.register.postfilter">registered</link> or loaded
|
||||||
from the plugins directory by using
|
from the <link linkend="variable.plugins.dir">plugins directory</link>
|
||||||
|
by using
|
||||||
<link linkend="api.load.filter">load_filter()</link> function or by
|
<link linkend="api.load.filter">load_filter()</link> function or by
|
||||||
setting
|
setting
|
||||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||||
@@ -26,8 +27,8 @@ function add_header_comment($tpl_source, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register the postfilter
|
// register the postfilter
|
||||||
$smarty->register_postfilter("add_header_comment");
|
$smarty->register_postfilter('add_header_comment');
|
||||||
$smarty->display("index.tpl");
|
$smarty->display('index.tpl');
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -41,6 +42,13 @@ $smarty->display("index.tpl");
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.register.postfilter">register_postfilter()</link>,
|
||||||
|
<link linkend="advanced.features.prefilters">prefilters</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.load.filter">load_filter()</link>
|
||||||
|
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
<para>
|
<para>
|
||||||
Prefilters can be either <link
|
Prefilters can be either <link
|
||||||
linkend="api.register.prefilter">registered</link> or loaded from
|
linkend="api.register.prefilter">registered</link> or loaded from
|
||||||
the plugins directory by using <link
|
the <link linkend="variable.plugins.dir">plugins directory</link>
|
||||||
|
by using <link
|
||||||
linkend="api.load.filter">load_filter()</link> function or by setting
|
linkend="api.load.filter">load_filter()</link> function or by setting
|
||||||
the <link linkend="variable.autoload.filters">$autoload_filters</link>
|
the <link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||||
variable.
|
variable.
|
||||||
@@ -22,25 +23,31 @@
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>using a template prefilter</title>
|
<title>using a template prefilter</title>
|
||||||
|
<para>
|
||||||
|
This will remove all the comments in the template source.
|
||||||
|
</para>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
// put this in your application
|
// put this in your application
|
||||||
function remove_dw_comments($tpl_source, &$smarty)
|
function remove_dw_comments($tpl_source, &$smarty)
|
||||||
{
|
{
|
||||||
return preg_replace("/<!--#.*-->/U","",$tpl_source);
|
return preg_replace("/<!--#.*-->/U",'',$tpl_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
// register the prefilter
|
// register the prefilter
|
||||||
$smarty->register_prefilter("remove_dw_comments");
|
$smarty->register_prefilter('remove_dw_comments');
|
||||||
$smarty->display("index.tpl");
|
$smarty->display('index.tpl');
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
|
||||||
This will remove all the comments in the template source.
|
|
||||||
</para>
|
|
||||||
</example>
|
</example>
|
||||||
|
<para>See also <link linkend="api.register.prefilter">register_prefilter()</link>,
|
||||||
|
<link linkend="advanced.features.postfilters">postfilters</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.load.filter">load_filter()</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Reference in New Issue
Block a user