Get Smarty

Donate

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Shop for 2018 World Cup Football Boots Online sale at guthjcc.com

Browse best 2018 world cup soccer cleats and shoes from SoccerAzteca.com

Advertisement

{setfilter}

{setfilter}...{/setfilter}块标签可以使用模板定义的变量过滤器。

语法: {setfilter filter1|filter2|filter3....}...{/setfilter}

过滤器可以是:

  • 变量过滤插件的名称。

  • 修饰器的名称和可选的参数。

{setfilter}...{/setfilter}可以被嵌套。 内部的过滤器块会被外部的过滤器块给替代。

模板过滤器可以和其他过滤器修饰器一起使用。 它们会按照如下顺序执行: 修饰器, 默认修饰器, $escape_html, 注册的变量过滤器, 自动载入的变量过滤器, 模板块变量过滤器。 所有在“默认修饰器”之后的东西,都可以被nofilter关闭。

Example 7.77. {setfilter} 标签


<script>
{setfilter filter1}
  {$foo} {* filter1 runs on output of $foo *}
  {setfilter filter2|mod:true}
    {$bar} {* filter2 and modifier mod runs on output of $bar *}
  {/setfilter}
  {$buh} {* filter1 runs on output of $buh *}
{/setfilter}
{$blar} {* no template instance filter runs on output of $blar}
</script>

  

Note

模板块变量过滤器不会影响到包含的子模板。

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 4 plus 8? (Are you human?)

Advertisement