0
在Smarty的,我們可以用它來縮短文本輸出:顯示在截斷智者鏈接
{$articleTitle}
{$articleTitle|truncate}
{$articleTitle|truncate:30}
{$articleTitle|truncate:30:""}
{$articleTitle|truncate:30:"---"}
{$articleTitle|truncate:30:"":true}
{$articleTitle|truncate:30:"...":true}
{$articleTitle|truncate:30:'..':true:true}
的結果會是這樣:
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after...
Two Sisters Reunite after
Two Sisters Reunite after---
Two Sisters Reunite after Eigh
Two Sisters Reunite after E...
Two Sisters Re..ckout Counter.
我想顯示是這樣的: 「... <a href="{$url}">read more</a>
」 當你把它應用到代碼,這將是這樣的:
{$articleTitle|truncate:30:"... <a href="{$url}">read more</a>":true}
但這不起作用。我怎樣才能使它工作?