Smarty 图标

根据商标通知,可以使用 Smarty 徽标。

Smarty Template Engine Smarty Template Engine

对于赞助、广告、新闻或其他疑问,请通过以下方式联系我们

使用 Smarty 的网站

广告

缩进

此操作在每行缩进一个字符串,默认值为 4。作为可选参数,可以指定缩进的字符数。作为可选的第二个参数,可以使用要缩进的字符,例如,对于 tab,使用"\t"

参数位置 类型 要求 默认 说明
1 整数 4 此变量将确定要缩进到的字符数。
2 字符串 (一个空格) 这是用来缩进的字符。

示例 5.12。缩进

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

   

请参阅 stripwordwrapspacify