strip函數(shù)
strip函數(shù):
Web 開發(fā)者多次遇到空格和回車影響HTML輸出的情形(瀏覽器的"特性"),為了得到特定的結(jié)果,因此你不得不在模板里運行所有的標(biāo)簽.?
通常在難以理解或難以處理的模板中遇到此問題.
Smarty 在顯示前將除區(qū)任何位于 {strip}{/strip} 標(biāo)記中數(shù)據(jù)的首尾空格和回車.
?這樣可以保證模板容易理解且不用擔(dān)心多余的空格導(dǎo)致問題.
eg:
{strip}
<table border=0>
????<tr>
????????<td>
????????????<A HREF="{$url}">
????????????????<font color="red">This is a test</font>
????????????</A>
????????</td>
????</tr>
</table>
{/strip}
輸出:
<table border=0><tr><td><A ><font color="red">This is a test</font></A></td></tr></table>