Chapter6.CombiningModifiers
第6章。组合修改器
Youcanapplyanynumberofmodifierstoavariable.Theywillbeappliedintheordertheyarecombined,fromlefttoright.Theymustbeseparatedwitha|(pipe)character.
对于同一个变量,你可以使用多个修改器。它们将从左到右按照设定好的顺序被依次组合使用。使用时必须要用"|"字符作为它们之间的分隔符。
Example6-1.combiningmodifiers
例6-1.组合修改器
index.php:
$smarty=newSmarty;
$smarty->assign('articleTitle','SmokersareProductive,butDeathCutsEfficiency.');
$smarty->display('index.tpl');
index.tpl:
{$articleTitle}
{$articleTitle|upper|spacify}
{$articleTitle|lower|spacify|truncate}
{$articleTitle|lower|truncate:30|spacify}
{$articleTitle|lower|spacify|truncate:30:"..."}
OUTPUT:
SmokersareProductive,butDeathCutsEfficiency.
SMOKERSAREPRODUCTIVE,BUTDEATHCUTSEFFICIENCY.
smokersareproductive,butdeathcuts...
smokersareproductive,but...
smokersarep...
阅读(956) | 评论(0) | 转发(0) |