Source for file function.html_radios.php
Documentation is available at function.html_radios.php
* Smarty {html_radios} function plugin
* File: function.html_radios.php<br>
* Purpose: Prints out a list of radio input types<br>
* - name (optional) - string default "radio"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or
* - output (optional) - without this one the buttons don't have names
* {html_radios values=$ids output=$names}
* {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte@ispi.net>
* @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_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING );
$selected = (string) $_val;
$smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING );
$smarty->trigger_error(" html_radios: extra attribute '$_key' cannot be an array" , E_USER_NOTICE );
if (!isset ($options) && !isset ($values))
return ''; /* raise error here? */
if (isset ($options) && is_array($options)) {
foreach ((array) $options as $_key=> $_val)
foreach ((array) $values as $_i=> $_key) {
$_val = isset ($output[$_i]) ? $output[$_i] : '';
if ($labels) $_output .= '<label>';
$_output .= '<input type="radio" name="'
$_output .= ' checked="checked"';
$_output .= $extra . ' />' . $output;
if ($labels) $_output .= '</label>';
$_output .= $separator . "\n";
Documentation generated on Mon, 25 Jun 2007 14:02:25 -0400 by phpDocumentor 1.3.2. PEAR Logo Copyright © PHP Group 2004.
|