Get Smarty


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 and save up to 80%.

Where to buy prescription glasses? is your best choice!

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

Shop for 2018 World Cup Football Boots Online sale at

Browse best 2018 world cup soccer cleats and shoes from



每个Smarty的标签都可以是显示一个 变量或者调用 某种类型的函数。 调用和显示的方式是在定界符内包含了函数,和其 属性, 如:{funcname attr1="val1" attr2="val2"}.

Example 3.3. 函数语法

{config_load file="colors.conf"}

{include file="header.tpl"}
{insert file="banner_ads.tpl" title="My Site"}

{if $logged_in}
    Welcome, <span style="color:{#fontColor#}">{$name}!</span>
    hi, {$name}

{include file="footer.tpl"}


  • 包括内置函数自定义函数 都是用同样的语法调用。

  • 内置函数是工作在Smarty 内部的函数, 类似 {if}, {section}{strip}等等。 它们不需要进行修改或者改变。

  • 自定义函数是通过插件定义的 额外的函数。 你可以任意修改自定义函数,或者创建一个新的函数。 {html_options}就是一个自定义函数的例子。


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