PHP Classes

File: class.phpTable.php

Recommend this page to a friend!
  Classes of Jake M   phpTable   class.phpTable.php   Download  
File: class.phpTable.php
Role: ???
Content type: text/plain
Description: The main class file
Class: phpTable
Author: By
Last change:
Date: 20 years ago
Size: 3,473 bytes
 

Contents

Class file image Download
<? # ----------------------------------------------------------------------------- # # Title: phpTable v1.0 # Filename: phpTable.php # Date: 2002-02-16 # Developer: Jake M. # E-mail: jake@alternacom.com # # Description: # # This is a class designed to reduce HTML coding for PHP programmers. The # first in a set of many similar classes, this program is designed to allow # developers with server-side needs to quickly and efficiently build the # client-side framework. As HTML code is highly subjective and differs from # one developer to the next, you can feel free to modify the HTML in this # class to fit your needs, and even add your own featutes. Feel free to # email me with any questions, comments, or suggestions. # # ----------------------------------------------------------------------------- class phpTable { // Basic table properties var $tableID; var $width; var $border; var $borderColor; var $cellPadding; var $cellSpacing; var $align; var $styleClass; function setProperty($key, $val) { // Set a property $this->$key = $val; } function beginTable() { $tableCode = "<table"; // Only output the property if the value is set. if ($this->tableID) { $tableCode .= " id=\"$this->tableID\""; } if ($this->width) { $tableCode .= " width=\"$this->width\""; } if ($this->align) { $tableCode .= " align=\"$this->align\""; } if ($this->border) { $tableCode .= " border=\"$this->border\""; } if ($this->borderColor) { $tableCode .= " bordercolor=\"$this->borderColor\""; } if ($this->cellPadding) { $tableCode .= " cellpadding=\"$this->cellPadding\""; } if ($this->cellSpacing) { $tableCode .= " cellspacing=\"$this->cellSpacing\""; } if ($this->styleClass) { $tableCode .= " class=\"$this->styleClass\""; } $tableCode .= ">\n"; echo $tableCode; } function beginCell($cellID, $bgColor, $bgImage, $width, $height, $hAlign, $vAlign, $colspan, $rowspan, $styleClass) { $tdCode = "<td"; // Only output the property if the value is set. if ($cellID) { $tdCode .= " id=\"$cellID\""; } if ($bgColor) { $tdCode .= " bgcolor=\"$bgColor\""; } if ($bgImage) { $tdCode .= " background=\"$bgImage\""; } if ($width) { $tdCode .= " width=\"$width\""; } if ($height) { $tdCode .= " height=\"$height\""; } if ($hAlign) { $tdCode .= " align=\"$hAlign\""; } if ($vAlign) { $tdCode .= " valign=\"$vAlign\""; } if ($colspan) { $tdCode .= " colspan=\"$colspan\""; } if ($rowspan) { $tdCode .= " rowspan=\"$rowspan\""; } if ($styleClass) { $tdCode .= " class=\"$styleClass\""; } $tdCode .= ">\n"; echo $tdCode; } function endCell() { print "</td>\n"; } function beginRow() { /* If you need to, you can add "align" and "valign" properties to this function just like beginCell() */ $trCode = "<tr>"; echo $trCode; } function endRow() { print "</tr>\n"; } function endTable() { print "</table>\n"; } } ?>