When the template is invoked via display() or fetch(), its output can be sent through one or more output filters. This differs from postfilters because postfilters operate on compiled templates before they are saved to the disk, whereas output filters operate on the template output when it is executed.
通过display()或fetch()执行模板时,输出 可以被发送到一个或多个输出过滤器,与postfilters不 同,postfilters在已编译的模板保存在硬盘前处理,而输出过滤器在模板执行后处理输出。
Output filters can be either registered or loaded from the plugins directory by using the load_filter() method or by setting the $autoload_filters variable. Smarty will pass the template output as the first argument, and expect the function to return the result of the processing.
输出 过滤器可以通过注册, 也可以使用load_filter()方 法或设置$autoload_filters变 量从plugins directory中加载。Smarty将把模板输出传递为第一个参数,然后获取函数处理后的结果。
Example 15-4. Using a template outputfilter 例 15-4. 使用模板输出过滤器
|
See also register_outpurfilter(), load_filter(), $autoload_filters, postfilters and $plugins_dir.
参考 register_outpurfilter(), load_filter(), $autoload_filters, postfilters and $plugins_dir.
当 前版本 2.6.25, http://www.smarty.net/do_download.php?download_file=Smarty-2.6.25.tar.gz
全部列表, http://smarty.php.net/download.php
smarty
[4]
[7]
cat将值连接到给定变量之 后, http://smarty.php.net/manual/en/language.modifier.cat.php[6]
escape转义修饰 符, http://smarty.php.net/manual/en/language.modifier.escape.php[10]
upper将字符串转换 成大写字母, http://smarty.php.net/manual/en/language.modifier.upper.php[4]
{config_load} 用于从一个配置文件加载配置变量到模板中, http://www.smarty.net/manual/en/language.builtin.functions.php
{foreach}, {foreachelse}用于像访问序数数组一样访问关联数组, http://smarty.php.net/manual/en/language.function.foreach.php[8]
{strip}在显示之 前删除每行前后多余的空格和回车字符, http://smarty.php.net/manual/en/language.function.strip.php[1]
{assign} 用于在模板执行过程中设置模板变量, http://smarty.php.net/manual/en/language.custom.functions.php#language.function.assign
{counter} 计数器, http://smarty.php.net/manual/en/language.custom.functions.php
借助cycle实现循环输出 值, http://smarty.php.net/manual/en/language.function.cycle.php[25]
$plugins_dir插件文件夹, http://smarty.net/manual/en/variable.plugins.dir.php[35]
[16]
[26]
[27]