What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
assignByRef() — 参照として値を割り当てます。
void assignByRef(string varname,
mixed var);
これを使用して、参照として
テンプレートに変数を 割り当て
ます。
PHP 5 以降では、assignByRef()
はほとんどの場合で不要になりました。
assignByRef()
が有用なのは、PHP の配列のインデックスの値を
テンプレートから再代入したい場合などです。オブジェクトのプロパティへの代入は、
デフォルトでこれと同じ挙動になります。
Example 13.4. assignByRef()
<?php // 名前/値のペアを渡します $smarty->assignByRef('Name', $myname); $smarty->assignByRef('Address', $address); ?>
assign()
、
clearAllAssign()
、
append()
、
{assign}
および
getTemplateVars()
も参照してください。