3 * Template_Lite {html_radios} function plugin
7 * Purpose: Creates a radio button
9 * - name = the name of the radio button
10 * - value = optional value for the checkbox
11 * - checked = boolean - whether the box is checked or not
12 * Author: Paul Lockaby <paul@paullockaby.com>
14 function tpl_function_html_radios($params, &$tpl)
16 require_once("shared.escape_chars.php");
21 foreach($params as $_key => $_value)
32 $extra .= ' ' . $_key . '="' . tpl_escape_chars($_value) . '"';
36 throw new Template_Exception("html_radio: attribute '$_key' cannot be an array", $tpl);
41 if (!isset($name) ||
empty($name))
43 throw new Template_Exception("html_radio: missing 'name' parameter", $tpl);
47 $toReturn = '<input type="radio" name="' . tpl_escape_chars($name) . '" value="' . tpl_escape_chars($value) . '"';
50 $toReturn .= ' checked';
52 $toReturn .= ' ' . $extra . ' />';