indent[縮進(jìn)]
indent[縮進(jìn)]
在每行縮進(jìn)字符串,默認(rèn)是4個(gè)字符。
作為可選參數(shù),你可以指定縮進(jìn)字符數(shù)。
作為第二個(gè)可選參數(shù),你可以指定縮進(jìn)用什么字符代替。
特別提示:使用縮進(jìn)時(shí)如果是在HTML中,則需要使用& n b s p;(空格)來(lái)代替縮進(jìn),否則沒(méi)有效果。
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle',
? ? ? ? ? ? ? ?'NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.'
? ? ? ? ? ? ? ?);
$smarty->display('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.
? ? Statistics show that teen pregnancy drops off significantly after 25.
? ? ? ? ? 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.
????Statistics show that teen pregnancy drops off significantly after 25.