indent[indent]

indent[Indent]

Indent the string in each line, the default is 4 characters.
As an optional parameter, you can specify the number of characters for indentation.
As the second optional parameter, you can specify what character to use for indentation.

Special tip: When using indentation, if it is in HTML, you need to use   (space) to replace the indentation, otherwise it will have no effect.

test.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(' test.html');

test.html:
{$articleTitle}
{$articleTitle|indent}
{$articleTitle|indent:10}
{$articleTitle|indent:1:"\t"}

Output:
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.

Continuing Learning
||
<?php echo "indent[缩进]";
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!