第 8章カスタム関数

目次
assign
counter
cycle
debug
eval
fetch
html_checkboxes
html_image
html_options
html_radios
html_select_date
html_select_time
html_table
math
mailto
popup_init
popup
simple_counter
textformat

Smartyは、テンプレートで使用可能なカスタム関数をいくつか実装しています。

assign

属性名必須デフォルト概要
varstringYesn/a割り当てられるテンプレート変数の名前
valuestringYesn/aテンプレート変数に割り当てる値

テンプレートにテンプレート変数を割り当てます。

例 8-1. assign

{assign var="name" value="Bob"}

The value of $name is {$name}.

出力:

The value of $name is Bob.