Source for file function.html_options.php
Documentation is available at function.html_options.php
* Smarty {html_options} function plugin
* - name (optional) - string default "select"
* - values (required if no options supplied) - array
* - options (required if no values supplied) - associative array
* - selected (optional) - string default not set
* - output (required if not options supplied) - array
* Purpose: Prints the list of <option> tags generated from
* @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
* @uses smarty_function_escape_special_chars()
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
foreach($params as $_key => $_val) {
$smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
if (!isset ($options) && !isset ($values))
return ''; /* raise error here? */
foreach ($options as $_key=> $_val)
foreach ((array) $values as $_i=> $_key) {
$_val = isset ($output[$_i]) ? $output[$_i] : '';
$_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
$_html_result .= ' selected="selected"';
foreach ($values as $key => $value) {
$optgroup_html .= "</optgroup>\n";
/* vim: set expandtab: */
|