count_characters
パラメータの位置 | 型? | 必須 | デフォルト | 概要 |
1 | boolean? | No | false | 空白キャラクタをカウントに含めるかどうか |
変数内の文字数をカウントします。
例 5-3. count_characters
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to >Temperatures.');
$smarty->display('index.tpl');
?>
index.tpl :
{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true}
出力:
Cold Wave Linked to Temperatures.
29
33