Recommend this page to a friend! |
DIV Based Table Generator | > | All threads | > | update | > | (Un) Subscribe thread alerts |
|
nmousdevlop - 2012-11-27 23:58:21
the variables into the constructor aren't declare and the method AddBodyCell() wasn't contain parameter $TableAlign. Now i thing it's good.
Good job and i wish you aking your best !!! her is the good script: ************************************************************************ <?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 { var $TableBackGroundColor; var $TableBorderColor; var $TableWidth; var $TableWidthCol; var $TableWidthColNo; var $HeaderCellStyle; var $BodyRowCellStyle; var $TableRowStyle; 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="",$TableAlign="center") { $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> "; } }; ?> ************************************************
Muhammad Arfeen - 2012-11-28 05:51:16 - In reply to message 1 from nmousdevlop
nmousdevlop.. gr8 ..its all open source .. so you can of course always make it better..hope you did the best. :) i will try ur code also and let u know :) thanks.
|
info at phpclasses dot org
.