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



{literal}可以让一个模板区域的字符原样输出。 这经常用于保护页面上的Javascript或css样式表,避免因为Smarty的定界符{语法}而错被解析。 在{literal}{/literal}内的任何标签都不会被解析,原样输出。 所以如果你有需要放到{literal}内的标签,首先可以考虑是否用 {ldelim}{rdelim} 来代替定界符在页面上的显示(不用{literal})。


因为Smarty会忽略那些带空格的定界符,所以通常不需要使用{literal}{/literal},。 请确定你的Javascript或者CSS样式表的大括号周围是有空格的。这是Smarty 3的新特性。

Example 7.59. {literal} 标签

   // the following braces are ignored by Smarty
   // since they are surrounded by whitespace
   function myFoo {
   // this one will need literal escapement
     function myBar {alert('Bar!');}


参见 {ldelim} {rdelim}避免Smarty解析

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 3 plus 14? (Are you human?)