Smarty自定義函數

自定義函數

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 自帶的一組自定義函數.

assign

Attribute Name Type Required Default 描述
var string Yes n/a The name of the variable being assigned
value string Yes n/a The value being assigned

屬性 類型 是否必須 缺省值 描述
var string Yes n/a 被賦值的變數名
value string Yes n/a 賦給變數的值

 

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.


上一篇: Smarty section,sectionelse 下一篇: Smarty assign用法