Smartyの修飾子
Nov 9, 2007AD:
Smartyの修飾子が便利なので忘れないうちにメモしておきます。
使い方
・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 | 単語の数を取得 | {} |
AD:

No Comments, Comment or Ping
Reply to “Smartyの修飾子”
Warning: Undefined variable $user_ID in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/themes/grid_focus_public_mizo/comments.php on line 66
You must be logged in to post a comment.