本文整理匯總了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;
}