indent

パラメータの位置?必須デフォルト概要
1integer?No4インデントするキャラクタ数
2string?No(one space)インデントに使用するキャラクタ

各行で文字列をインデントします。デフォルトは4です。
第1パラメータには、インデントするキャラクタ数が 指定できます。第2パラメータには、インデントに使用するキャラクタが指定できます。(タブは"\t")


例 5-11. indent

<?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('index.tpl');

?>

index.tpl :

{$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.

2005年07月08日(金) 10:59:37 Modified by smarten




スマートフォン版で見る