3 * template_lite {html_input} function plugin
7 * Purpose: Creates an input text or password box
9 * - name = the name of the textbox
10 * - password = boolean - if set, this box will be a password box
11 * - value = optional default value for the input box
12 * - size = optional size for the input box
13 * - length = optional maxlength for the input box
14 * Author: Paul Lockaby <paul@paullockaby.com>
16 function tpl_function_html_input($params, &$tpl)
18 require_once("shared.escape_chars.php");
24 foreach($params as $_key => $_value)
38 $extra .= ' ' . $_key . '="' . tpl_escape_chars($_value) . '"';
42 throw new Template_Exception("html_input: attribute '$_key' cannot be an array", $tpl);
47 if (!isset($name) ||
empty($name))
49 throw new Template_Exception("html_input: missing 'name' parameter", $tpl);
53 $toReturn = '<input type="';
54 $toReturn .= $password ?
'password' : 'text';
55 $toReturn .= '" name="' . tpl_escape_chars($name) . '" value="' . tpl_escape_chars($value) . '" ' . $extra . ' />';