配列に対して修飾子を用いた場合は、その配列に格納された全ての値に影響を及ぼします。 配列全体を1つの値として作用させるには修飾子の先頭に @ 記号をつける必要があります。 例:{$articleTitle|@count} - これは、 配列 $articleTitle の要素数を、php の count() 関数を修飾子として用いて出力します。 http://www.smarty.net/manual/ja/language.modifiers.php
Smartyのtruncateマルチバイト文字列に対応していません。 カットされた位置によっては文字化けしてしまいます。 日本語もキレイに指定文字数でカットしたいなら マルチバイト対応のtruncateを作っちゃいましょう。 function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...') { if ($length == 0) {return '';} if (mb_strlen($string) > $length) { return mb_substr($string, 0, $length).$etc; } else { return $string; } } このソースをmodifier.mb_truncate.phpというファイル名で Smartyのpluginディレクトリ”Smarty/libs
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く