<< Back to man.ChinaUnix.net

Chapter 8. Custom Functions[第八章.自定义函数]

Table of Contents
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
textformat

Smarty comes with several custom functions that you can use in the templates.

用户可以使用 Smarty 自带的一组自定义函数.

assign

Attribute NameTypeRequiredDefaultDescription
varstringYesn/aThe name of the variable being assigned
valuestringYesn/aThe value being assigned

属性类型是否必须缺省值描述
varstringYesn/a被赋值的变量名
valuestringYesn/a赋给变量的值

assign is used for assigning template variables during the execution of the template.

assign 用于在模板被执行时为模板变量赋值.

Example 8-1. assign
例 8-1. assign 函数演示

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

The value of $name is {$name}.

OUTPUT:

The value of $name is Bob.