strip

    将所有重复的空格、换行、制表符等替换为单个的空格或指定的字符串。

注意:如果你要处理的是模板文本块,请使用内建函数{strip}

例子5-19. strip

<?php
$smarty
->assign('articleTitle'"Grandmother of\neight makes\t    hole in one.");
$smarty->display('index.tpl');
?>

    模板为:

{$articleTitle}
{$articleTitle|strip}
{$articleTitle|strip:'&nbsp;'}

    输出为:

Grandmother of
eight makes        hole in one.
Grandmother of eight makes hole in one.
Grandmother&nbsp;of&nbsp;eight&nbsp;makes&nbsp;hole&nbsp;in&nbsp;one.

    参见{strip}truncate