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



很多时候,页面设计师会遇到模板上的空格和回车影响到页面输出HTML的情况(浏览器“特性”), 所以你可以把你的标签都放到一起,以取得想要的结果。但这很容易最终导致模板无法阅读和管理。

任何在{strip}{/strip}中的标签都会被过滤掉多余的空格和回车, 并把全部标签放在同一行内显示。 这样你的模板还是可读的,而且也不需要担心多余的空格问题。


{strip}{/strip}不会作用于变量的内容, 需要使用strip 修饰器来过滤变量内容。

Example 7.78. {strip} 标签

{* the following will be all run into one line upon output *}
<table border='0'>
   <a href="{$url}">
    <font color="red">This is a test</font>



<table border='0'><tr><td><a href="http://. snipped...</a></td></tr></table>


注意上面的例子,在一行内显示了全部的HTML标签,而且是全部文字都会放到一起。 如果你有要原样输出的多行文字,那么它们也会变成一行显示。

参见 strip 修饰器.

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 10 plus 11? (Are you human?)