1<?php 2/** 3 * template_lite {html_hidden} function plugin 4 * 5 * Type: function 6 * Name: html_hidden 7 * Purpose: Creates a hidden box 8 * Input: 9 * - name = the name of the hidden field 10 * - value = the value of the hidden field 11 * Author: Paul Lockaby <paul@paullockaby.com> 12 */ 13function tpl_function_html_hidden($params, &$tpl) 14{ 15 require_once("shared.escape_chars.php"); 16 $name = null; 17 $value = ''; 18 $extra = ''; 19 20 foreach($params as $_key => $_value) 21 { 22 switch($_key) 23 { 24 case 'name': 25 case 'value': 26 $$_key = $_value; 27 break; 28 default: 29 if(!is_array($_key)) 30 { 31 $extra .= ' ' . $_key . '="' . tpl_escape_chars($_value) . '"'; 32 } 33 else 34 { 35 $tpl->trigger_error("html_hidden: attribute '$_key' cannot be an array"); 36 } 37 } 38 } 39 40 if (!isset($name) || empty($name)) 41 { 42 $tpl->trigger_error("html_input: missing 'name' parameter"); 43 return; 44 } 45 46 $toReturn = '<input type="hidden" name="' . tpl_escape_chars($name) . '" value="' . tpl_escape_chars($value) . '" ' . $extra . ' />'; 47 return $toReturn; 48} 49?>