+ add hidden() and password() method.

This commit is contained in:
wangchunsheng
2009-12-04 09:57:30 +00:00
parent d7c699be1b
commit cbd5cf2753

View File

@@ -89,7 +89,7 @@ class html
* @param string $checked the value to checked by default.
* @param string $attrib other attribs.
*/
static public function radio($name = '', $options = array(), $checked = "", $attrib = "")
static public function radio($name = '', $options = array(), $checked = '', $attrib = '')
{
$options = (array)($options);
if(!is_array($options) or empty($options)) return false;
@@ -97,8 +97,6 @@ class html
$string = '';
foreach($options as $key => $value)
{
$key = str_replace('item', '', $key); // 因为对象的元素不能为数字所以需要在配置里面会在数字前面添加item这个地方将item去掉。
$string .= "<input type='radio' name='$name' value='$key' ";
$string .= ($key == $checked) ? " checked ='checked'" : "";
$string .= $attrib;
@@ -145,6 +143,30 @@ class html
return "<input type='text' name='$name' id='$name' value='$value' $attrib />\n";
}
/**
* create tags like "<input type='hidden' />"
*
* @param string $name the name of the text input tag.
* @param string $value the default value.
* @param string $attrib other attribs.
*/
static public function hidden($name, $value = "", $attrib = "")
{
return "<input type='hidden' name='$name' id='$name' value='$value' $attrib />\n";
}
/**
* create tags like "<input type='password' />"
*
* @param string $name the name of the text input tag.
* @param string $value the default value.
* @param string $attrib other attribs.
*/
static public function password($name, $value = "", $attrib = "")
{
return "<input type='password' name='$name' id='$name' value='$value' $attrib />\n";
}
/**
* create tags like "<textarea></textarea>"
*