What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
各行で文字列をインデントします。デフォルトは 4 です。
第1パラメータには、インデントするキャラクタ数が指定できます。
第2パラメータには、インデントに使用するキャラクタが指定できます。
たとえば、"\t"
はタブを表します。
パラメータの位置 | 型 | 必須 | デフォルト | 概要 |
---|---|---|---|---|
1 | integer | No | 4 | インデントするキャラクタ数 |
2 | string | No | (半角スペース 1 文字) | インデントに使用するキャラクタ |
Example 5.12. indent
<?php $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.' ); ?>
テンプレート
{$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.