indent[縮排]
在每行縮排字串,預設是4個字元。
作為可選參數,你可以指定縮排字元數。
作為第二個可選參數,你可以指定縮排用什麼字元取代。
特別提示:使用縮排時如果是在HTML中,則需要使用& n b s p;(空格)來取代縮進,否則沒有效果。
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle',
'NJ 'NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.'
off test.html');
test.html:{$articleTitle}
{$articleTitle|indent}
{$articleTitle|indent:10}
{$articleTitle|indent:1:"\t"}
輸出:NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.
NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.## Sun or rain expected today, dark tonight.#a] Sun or rain expected today, dark tonight.a drops off significantly after 25.
NJ judge to rule on nude beach.
Sun or rain expected today, dark Sun or rain 是ly after 25.
NJ judge to #下一節