whiplk

Class Table

Jan 30th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. //Código para construir a Classe table
  2. class table {
  3.     private $tag;
  4.    
  5.     function Begin($border=0, $align="center", $width='100%', $cellpadding=2,$cellspacing=2, $class=", $id=", $bgcolor=", $style="){
  6.         $this->tag='<table ';
  7.         if($aling)  $this->tag .='align="'.$aling.'"';
  8.         if($width)  $this->tag .='width="'.$width.'"';
  9.         if($border > 0) $this->tag .='border="'.$border.'"';
  10.         if($cellpadding > 0)    $this->tag .='cellpadding="'.$cellpadding.'"';
  11.         if($cellspacing > 0)    $this->tag .='cellspacing="'.$cellspacing.'"';
  12.         if($class)  $this->tag .='class="'.$class.'"';
  13.         if($id) $this->tag .='id="'.$id.'"';
  14.         if($bgcolor)    $this->tag .='bgcolor="'.$bgcolor.'"';
  15.         if($style)  $this->tag .='style="'.$style.'"';
  16.         $this->tag .=">";
  17.         return $this->tag;
  18.     }
  19.    
  20.     function Header($text){
  21.         $this->tag='<th>'.$text.'</th>';
  22.         return $this->tag;
  23.     }
  24.    
  25.     function RowOn($align="",$bgcolor="",$class="",$height=""){
  26.         $this->tag='<tr';
  27.         if($align)  $this->tag .='align="'.$align.'"';
  28.         if($bgcolor)    $this->tag .='bgcolor="'.$bgcolor.'"';
  29.         if($class)  $this->tag .='class="'.$class.'"';
  30.         if($height) $this->tag .='height="'.$height.'"';
  31.         $this->tag .=">";
  32.         return $this->tag;
  33.     }
  34.    
  35.     function ColumnOn($colspan=1,$align='left',$width="",$rowspan="",$bgcolor="",$class="",$valign="",$height=""){
  36.         $this->tag='<td';
  37.         if($align)    $this->tag .='align="'.$align.'"';
  38.         if($colspan)    $this->tag .='colspan="'.$colspan.'"';
  39.         if($width)    $this->tag .='width="'.$width.'"';
  40.         if($rowspan)    $this->tag .='rowspan="'.$rowspan.'"';
  41.         if($bgcolor)    $this->tag .='bgcolor="'.$bgcolor.'"';
  42.         if($class)    $this->tag .='class="'.$class.'"';
  43.         if($height)    $this->tag .='height="'.$height.'"';
  44.         if($valign)    $this->tag .="valign="'.$valign.'"";
  45.         if(!$valign)    $this->tag .="valign='middle'>";
  46.         return $this->tag;
  47.     }
  48.    
  49.     function ColumnOff(){
  50.         $this->tag='</td>';
  51.         return $this->tag;
  52.     }
  53.    
  54.     function RowOff(){
  55.         $this->tag='</tr>';
  56.         return $this->tag;
  57.     }
  58.    
  59.     function End(){
  60.         $this->tag='</table>';
  61.         return $this->tag;
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment