This is used to count the number of characters in a variable.
此函式用來計算變數中字母的字數。
Example 5-3. count_characters
<?php$smarty = new Smarty;$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');$smarty->display('index.tpl');?>
Where index.tpl is:
其中 index.tpl 內容為:
{$articleTitle} {$articleTitle|count_characters} {$articleTitle|count_characters:true}
This will output:
輸出結果為:
Cold Wave Linked to Temperatures. 29 33