Smartyの修飾子
Nov 9, 2007Smartyの修飾子が便利なので忘れないうちにメモしておきます。
使い方
・hoge.php(データの生成)
$smarty = new Smarty;
$smarty->assign(‘hoge’, strtotime(‘-1 day’));
$smarty->display(‘hoge.tpl’);
・hoge.tpl(表示側)
{$hoge|date_format:”%c/%m/%d”}
・実行結果
07/11/08
修飾子の一覧
| 修飾子 | 内容 | 補足 | 
| captilize | 単語の頭文字を大文字に変換 | {} | 
|---|---|---|
| cat | 指定された変数を連結 | {} | 
| lower | 小文字に変換 | {} | 
| upper | 小文字に変換 | {} | 
| regex_replace | 置き換え(正規表現対応) | {} | 
| replace | 置き換え(正規表現未使用) | {} | 
| date_format | 日付のフォーマッティング | {} | 
| string_format | 文字列のフォーマッティング | {} | 
| defaultt | デフォルト値の指定 | {} | 
| strip | 空白の除去/置換え | {} | 
| defaultt | デフォルト値の指定 | {} | 
| strip | 空白の除去/置換え | {} | 
| strip_tags | タグの除去 | {} | 
| nl2br | 改行文字を タグに変換 | {} | 
| escape | エスケープ処理 | {} | 
| spacify | 各文字間にスペースを挿入 | {} | 
| truncate | 指定行で文字を切り捨て | {} | 
| wordwrap | 指定行でワードラップ | {} | 
| indent | インデント | {} | 
| count_characters | 文字数を取得 | {} | 
| count_paragraphs | パラグラフ数を取得 | {} | 
| count_sentences | センテンスを数を取得 | {} | 
| count_words | 単語の数を取得 | {} | 
Twitter: 
Warning:  Undefined array key "Twitter" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0 | Facebook: 0 | Google Plus: 
Warning:  Undefined array key "Google+" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0			| Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0
 Ayumi Mizoshiri
Ayumi Mizoshiri






