Board logo

标题: smarty capitalize [打印本页]

作者: fangzhen    时间: 2011-1-30 23:50     标题: 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.





欢迎光临 PHP开发笔记 (http://phpvi.com/) Powered by Discuz! 6.1.0