note 112153 deleted from language.oop5 by googleguy
| From: | googleguy@php.net | Date: | Fri, 10 May 2013 11:07:39 +0000 |
| Subject: | note 112153 deleted from language.oop5 by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194772@lists.php.net to get a copy of this message | ||
Note Submitter: hafiz_fp_bd at yahoo dot com
----
<?php
/**
* Description of bshtml class for HTML attribute,elements
* @author Md.Hafizur Rahman
*/
interface intf_html
{
public function form_open($form_data=array());
public function form_close();
public function input($input_data=array());
public function datalist($attr=array(),$value=array());
public function image($attr_list=array());
public function redirect($time,$url);
}
class bshtml implements intf_html
{
var $form_attribute;
var $input_attribute;
var $datalist_attribute;
var $datalist_value;
var $datalist_string;
var $image_attribute;
public function form_open($form_data=array())
{
$this->form_attribute;
foreach ($form_data as $key => $value)
{
$this->form_attribute.= $key."='".$value."' ";
}
return "<form ".$this->form_attribute." />";
}
public function form_close()
{
return "</form>";
}
public function input($input_data=array())
{
$this->input_attribute='';
foreach ($input_data as $key => $value)
{
$this->input_attribute.= $key."='".$value."' ";
}
return "<input ".$this->input_attribute." />";
}
public function datalist($attr=array(),$value=array())
{
$this->datalist_string='';
$this->datalist_attribute='';
$this->datalist_value='';
$dln=date('mhs');
foreach ($attr as $key => $aval)
{
$this->datalist_attribute.= $key."='".$aval."' ";
}
foreach ($value as $val)
{
$this->datalist_value.= "<option
value='".$val."'>";
}
$this->datalist_string.="<INPUT list='".$dln."'
".$this->datalist_attribute.">";
$this->datalist_string.="<datalist id='".$dln."'>";
$this->datalist_string.=$this->datalist_value;
$this->datalist_string.="</datalist>";
return $this->datalist_string;
}
public function image($attr_list=array())
{
$this->image_attribute='';
foreach ($attr_list as $key => $value)
{
$this->image_attribute.= $key."='".$value."' ";
}
return "<img ".$this->image_attribute." />";
}
public function redirect($time,$url)
{
return "<META HTTP-EQUIV='REFRESH' CONTENT='".$time.";
URL=".$url."'>";
}
}
$obj=new bshtml();
echo
$obj->form_open(array('Method'=>'POST','Action'=>'#'));
echo
$obj->input(array('TYPE'=>'TEXT','NAME'=>'USERID'));
echo
$obj->input(array('TYPE'=>'PASSWORD','NAME'=>'PASS'));
echo
$obj->input(array('TYPE'=>'Submit','NAME'=>'submit','Value'=>'Login'));
echo $obj->form_close();
?>