mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
add label ids to html_radios
This commit is contained in:
@@ -9,6 +9,7 @@ INSTALL SMARTY LIBRARY FILES
|
|||||||
Copy the Smarty library files to your system. In our example, we place them in
|
Copy the Smarty library files to your system. In our example, we place them in
|
||||||
/usr/local/lib/php/Smarty/
|
/usr/local/lib/php/Smarty/
|
||||||
|
|
||||||
|
$> cd YOUR_DOWNLOAD_DIRECTORY
|
||||||
$> gtar -ztvf Smarty-2.6.7.tar.gz
|
$> gtar -ztvf Smarty-2.6.7.tar.gz
|
||||||
$> mkdir /usr/local/lib/php/Smarty
|
$> mkdir /usr/local/lib/php/Smarty
|
||||||
$> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
|
$> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
|
||||||
|
@@ -127,11 +127,16 @@ function smarty_function_html_radios($params, &$smarty)
|
|||||||
|
|
||||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) {
|
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) {
|
||||||
$_output = '';
|
$_output = '';
|
||||||
if ($labels) $_output .= '<label>';
|
if ($labels) {
|
||||||
$_output .= '<input type="radio" name="'
|
$_id = smarty_function_escape_special_chars($name . '_' . $value);
|
||||||
|
$_output .= '<label for="' . $_id . '">';
|
||||||
|
}
|
||||||
|
$_output .= '<input type="radio" name="'
|
||||||
. smarty_function_escape_special_chars($name) . '" value="'
|
. smarty_function_escape_special_chars($name) . '" value="'
|
||||||
. smarty_function_escape_special_chars($value) . '"';
|
. smarty_function_escape_special_chars($value) . '"';
|
||||||
|
|
||||||
|
if ($labels) $_output .= ' id="' . $_id . '"';
|
||||||
|
|
||||||
if ($value==$selected) {
|
if ($value==$selected) {
|
||||||
$_output .= ' checked="checked"';
|
$_output .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user