Get Smarty

Donate

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

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Advertisement

strip

转换连续空格,回车和tab到单个空格或是指定字符串。

说明

如果你希望转换模板文字内的空格,使用内置的 {strip} 函数。

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

Comments
No comments for this page.

Advertisement