Login   Register  
PHP Classes
elePHPant
Icontem

File: DIVBasedTable.inc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Muhammad Arfeen  >  DIV Based Table Generator  >  DIVBasedTable.inc.php  >  Download  
File: DIVBasedTable.inc.php
Role: Class source
Content type: text/plain
Description: Main Class
Class: DIV Based Table Generator
Generate table like HTML layouts using only DIVs
Author: By
Last change: Added some more styles.
Date: 5 years ago
Size: 2,772 bytes
 

Contents

Class file image Download
<?php

/*
This DIVBasedTable.inc.php can be used to make DIV based simple tables with additional
user defined inline style sheets. Steps are shown for a sample DIV based table design.

Written by: Muhammad Arfeen

*/

class DIVBasedTable {

    

        function 
DIVBasedTable($TableCaption="") {
            
                
$this->TableBackGroundColor="";
                
$this->TableBorderColor="";
                
$this->TableBorder="";
                
$this->TableWidth;        
                
$this->TableWidthCol;
                
$this->TableWidthColNo;
                
$this->HeaderCellStyle;
                
$this->BodyRowCellStyle;
                
$this->TableRowStyle;
            
#    $this->FinalTable = $this->GetCSS();
                    
                
        
        
}
        
        function 
StartTable($TableAlign="center") {
            
                            
$this->FinalTable .= "<DIV class='base-layer' align=\"$TableAlign\"> ";        
                            
        }
        
        function 
StartHeader($HeaderRowID="",$Style="",$TableAlign="center") {
            
                            
$this->FinalTable .= "<div class='MyTableRowClass' ID='$HeaderRowID'  align=\"$TableAlign\"> ";                        
                            
        }
        
        function 
AddHeaderCell($HeaderText="AddColumn",$Style="",$TableAlign="center") {
            
                            
$this->FinalTable .= "<div class='MyMainTableRowClass' style='$Style' align=\"$TableAlign\"><h5 class='MyTableHeaderClass'>";
                            
$this->FinalTable .= $HeaderText "</h5></DIV>";
                            
        }
        
        function 
StopHeader(){
            
                            
$this->FinalTable .= "</DIV>";
        }
        
        function 
StartTableRow($BodyRowID="",$Style="",$TableAlign="center") {
            
                
$this->FinalTable .= "<div class='MyTableRowClass' ID='$BodyRowID' style='$Style' align=\"$TableAlign\"> ";        
                
        }
        
        function 
AddBodyCell($HeaderText="BodyCell",$Style="") {
            
                            
$this->FinalTable .= "<div class='MyMainTableRowClass' style='$Style' align=\"$TableAlign\"><P class='MyTableCellTextClass'>";
                            
$this->FinalTable .= $HeaderText "</P></DIV>";
                            
        }
        
        function 
StopTableRow(){
            
                            
$this->FinalTable .= "</DIV>";
        }
        
        function 
CloseTable(){
            
                            
$this->FinalTable .= "</DIV>";
        }
        
        function 
GetFinalTable(){
            
            return 
$this->FinalTable;
            
        }
        
        function 
GetCSS() {
            
            
            
$this->TableWidthCol =  sprintf("%d",$this->TableWidth $this->TableWidthColNo) . "%";
            
            
$this->FinalTable .= "<style>
             DIV.base-layer {
   border: solid #f8f8f8 1px; 
  "
.$this->TableStyle."; padding: 0; text-align: center; width: auto; 
}

DIV.MyTableRowClass {
   width: "
.$this->TableWidth."; 
}


DIV.MyMainTableRowClass {
  float: left; margin: 0; padding: 0; width: "
.$this->TableWidthCol."; ".$this->TableRowStyle."
}


H5.MyTableHeaderClass {
  "
.$this->HeaderCellStyle."
}

P.MyTableCellTextClass {
  "
.$this->BodyRowCellStyle."
}


</style>
"
;
        
        
            
        }
        
        


};


?>