Smarty †Assign †{assign var=id value=$smarty.foreach.name.iteration} {assign var=number value="`$number*2+1`"} Section †for文的な使い方 {section name=cnt start=0 loop=10} {$smarty.section.cnt.index}<br> {/section} Foreach †{foreach key=key item=item from=$sample_options name="data"} {assign var="num" value=$smarty.foreach.data.iteration} {/foreach} Select †<SELECT name=sample_id> {html_options options=$sample_options selected=$sample_id} </SELECT> Select(年月日) †{html_select_date prefix="sample_date_" field_order="Y" time=$default.sample_date|escape year_empty="-----" start_year="$start_year" end_year="$stop_year"}年 {html_select_date prefix="sample_date_" field_order="M" time=$default.sample_date|escape month_empty="-----" month_format="%m"}月 {html_select_date prefix="sample_date_" field_order="D" time=$default.sample_date|escape day_empty="----" day_format="%02d"}日 Radio †{html_radios name="sample_id" options=$sample_options selected=$sample_id separator="<br />"} Checkbox †{html_checkboxes name="sample_id" options=$sample_options selected=$sample_id separator="<br />"} パイプでPHP関数を使う場合 †$sampleのBをCに置き換えたいとする。 $sample = 'AAABAAABAAA'; 以下のように書くと、$testが自動的にstr_replaceの第一引数となり意図した動作をしない。 $sample|str_replace:'B':'C' 強引ではあるが、以下のように第一引数にBがくるように、Cが第二引数、$testが第三引数になるようにする。 'B'|str_replace:'C':$sample 参考(str_replace関数) mixed str_replace ( mixed $search, mixed $replace, mixed $subject [, int &$count] ) Insert †insertは、テンプレートのキャッシュが有効であってもinsertタグによる出力はキャッシュされない チョメチョメを使いたいとき †{$password|regex_replace:"/[a-zA-Z0-9]/":'*'|escape}
Counter: 10013,
today: 1,
yesterday: 0
|