本文整理汇总了PHP中smarty_function_html_options_optgroup函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_function_html_options_optgroup函数的具体用法?PHP smarty_function_html_options_optgroup怎么用?PHP smarty_function_html_options_optgroup使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_function_html_options_optgroup函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_html_options_optoutput
function smarty_function_html_options_optoutput($key,$value,$selected) {
if(!is_array($value)) {
$_html_result = '<option label="'.smarty_function_escape_special_chars($value) .'" value="'.
smarty_function_escape_special_chars($key) .'"';
if (in_array((string)$key,$selected))
$_html_result .= ' selected="selected"';
$_html_result .= '>'.smarty_function_escape_special_chars($value) .'</option>'."\n";
}else {
$_html_result = smarty_function_html_options_optgroup($key,$value,$selected);
}
return $_html_result;
}
示例2: smarty_function_html_options_optoutput
function smarty_function_html_options_optoutput($key, $value, $selected)
{
if (!is_array($value)) {
$html_result = '<option label="' . htmlspecialchars($value) . '" value="' . htmlspecialchars($key) . '"';
if (in_array($key, $selected)) {
$html_result .= " selected=\"selected\"";
}
$html_result .= '>' . htmlspecialchars($value) . '</option>' . "\n";
} else {
$html_result = smarty_function_html_options_optgroup($key, $value, $selected);
}
return $html_result;
}
示例3: smarty_function_html_options_optoutput
function smarty_function_html_options_optoutput($key, $value, $selected)
{
if (!is_array($value)) {
$html_result = "<option label=\"{$key}\" value=\"{$key}\"";
if (in_array($key, $selected)) {
$html_result .= " selected=\"selected\"";
}
$html_result .= ">{$value}</option>\n";
} else {
$html_result = smarty_function_html_options_optgroup($key, $value, $selected);
}
return $html_result;
}
示例4: smarty_function_html_options_optoutput
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
if (!is_array($value)) {
$_key = smarty_function_escape_special_chars($key);
$_html_result = '<option value="' . $_key . '"';
if (is_array($selected)) {
if (isset($selected[$_key])) {
$_html_result .= ' selected="selected"';
}
} elseif ($_key === $selected) {
$_html_result .= ' selected="selected"';
}
$_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
$_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
if (is_object($value)) {
if (method_exists($value, "__toString")) {
$value = smarty_function_escape_special_chars((string) $value->__toString());
} else {
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
return '';
}
} else {
$value = smarty_function_escape_special_chars((string) $value);
}
$_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
$idx++;
} else {
$_idx = 0;
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? $id . '-' . $idx : null, $class, $_idx);
$idx++;
}
return $_html_result;
}
示例5: smarty_function_html_options_optoutput
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
if (!is_array($value)) {
$_html_result = '<option value="' . smarty_function_escape_special_chars($key) . '"';
if (in_array((string) $key, $selected)) {
$_html_result .= ' selected="selected"';
}
$_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
$_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
$_html_result .= $_html_class . $_html_id . '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
$idx++;
} else {
$_idx = 0;
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, $id . '-' . $idx, $class, $_idx);
$idx++;
}
return $_html_result;
}
示例6: smarty_function_wap_html_options_optoutput
function smarty_function_wap_html_options_optoutput($key, $value, $selected)
{
if (!is_array($value)) {
$_html_result = '<option value="' . smarty_function_escape_special_chars($key) . '"';
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
} else {
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
}
return $_html_result;
}