$_val)
{
switch($_key)
{
case 'name':
$$_key = (string)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'selected':
$$_key = array_values((array)$_val);
break;
default:
if(!is_array($_key))
{
$extra .= ' ' . $_key . '="' . tpl_escape_chars($_val) . '"';
}
else
{
throw new Template_Exception("html_select: attribute '$_key' cannot be an array", $tpl);
}
break;
}
}
$_html_result = '';
if (is_array($options))
{
foreach ($options as $_key=>$_val)
{
$_html_result .= tpl_function_html_options_optoutput($tpl, $_key, $_val, $selected);
}
}
else
{
foreach ((array)$values as $_i=>$_key)
{
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= tpl_function_html_options_optoutput($tpl, $_key, $_val, $selected);
}
}
if(!empty($name))
{
$_html_result = '' . "\n";
}
return $_html_result;
}
function tpl_function_html_options_optoutput(&$tpl, $key, $value, $selected)
{
if(!is_array($value))
{
$_html_result = '\n";
return $optgroup_html;
}
?>