smarty变量调节器--capitalize[首字符大写]

将变量里的所有单词首字大写。它与php的ucwords()函数类似。

参数位置 类型 必需 默认 描述
1 Boolean No FALSE 确定带数字的单词是否需要大写

例 5-2.首字大写

<?php
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
?>

Where the template is:
{$articleTitle}
{$articleTitle|capitalize}
{$articleTitle|capitalize:true}

Will output:
next x-men film, x3, delayed.
Next X-Men Film, x3, Delayed.
Next X-Men Film, X3, Delayed.
posted @ 2012-03-08 13:26  haiwei.sun  阅读(242)  评论(0编辑  收藏  举报
返回顶部