smarty template engine
Thursday, September 02, 2010  
download | documentation | faq | forum | mailing lists | changelog | contribs 


Translate this page to:
search for in the


indent

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

パラメータの位置必須デフォルト概要
1integerNo4インデントするキャラクタ数
2stringNo(半角スペース 1 文字)インデントに使用するキャラクタ

例 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.

stripwordwrap および spacify も参照してください。



[advertise]


credits 

Smarty Copyright © 2002-2008
New Digital Group, Inc.

All rights reserved.