发新话题
打印

smarty capitalize

smarty capitalize

This is used to capitalize the first letter of all words in a variable.
将变量里的所有单词首字大写。

例子:

index.php:

$smarty = new Smarty;
$smarty->assign('articleTitle', 'Police begin campaign to rundown jaywalkers.');
$smarty->display('index.tpl');

index.tpl:

{$articleTitle}
{$articleTitle|capitalize}

输出结果:

Police begin campaign to rundown jaywalkers.
Police Begin Campaign To Rundown Jaywalkers.

TOP

发新话题