| Attribute Name | Type | Required | Default | Description |
|---|---|---|---|---|
| values | array | Yes, unless using options attribute | n/a | an array of values for dropdown |
| output | array | Yes, unless using options attribute | n/a | an array of output for dropdown |
| selected | string/array | No | empty | the selected option element(s) |
| options | associative array | Yes, unless using values and output | n/a | an associative array of values and output |
| name | string | No | empty | name of select group |
html_options is a custom function that creates html option group with provided data. It takes care of which item(s) are selected by default as well. Required attributes are values and output, unless you use options instead.
html_options 是一個客制化函式,可以根據所提供的資料產生 html option 。此函式也可以控制預設選項。此函式需要的屬性為 values 與 output,也可以使用 options 以取代前兩者。
If a given value is an array, it will treat it as an html OPTGROUP, and display the groups. Recursion is supported with OPTGROUP. All output is XHTML compatible.
如果被給定的值是陣列的話,Smarty 會將陣列值視為一個 html OPTGROUP, 然後呈現。OPTGROUP 支援遞迴。所有的輸出結果都與 XHTML 相容。
If the optional name attribute is given, the <select name="groupname"></select> tags will enclose the option list. Otherwise only the option list is generated.
如果非必要 name 屬性也有設定的話,則會產生 <select name="groupname"></select> 標籤 ,否則只會產生 option 標籤。
All parameters that are not in the list above are printed as name/value-pairs inside the <select>-tag. They are ignored if the optional name is not given.
所有在上面所列出的參數並不是每個都可以以 name/value 的方式在 <select> 標籤中列印出來的。如果非必要的 name 屬性沒有設定的話,則以上的值都將會被忽略而不列印出。