Get Smarty

Donate

Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

indent

缩进每一行的字符串,默认是缩进4个空格。 可选的参数可以设置缩进的空格数量。 可选的第二个参数设置缩进使用的字符,如用 "\t" 来代替空格缩进。

参数顺序 类型 必选参数 默认值 说明
1 integer No 4 设置缩进多少空格
2 string No 一个空格 设置用什么字符来进行缩进

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.

   

参见 strip, wordwrapspacify.

Comments
No comments for this page.

Advertisement