PhpSnip.com

User Stats

tables.php - part of the html.php library

Ease the pain of escaping quotes and clean up your php code, use tables.php. Made to go with html.php, lists.php, and forms.php, but they're really only groups of functions.

Info

 Download  View Source (print view)
 Rating : 4.7  Views : 475

Source Code ( 49 lines )

<?php
	/* tables.php3
	 *
	 * functions to create html tables
	 *
	 * Refer HTML questions to http://www.w3.org/TR/REC-html40/
	 */

	/* let other includes know we're here.. */
	define("USING_TABLES", "Yup");

	/* begin function declaration */

	function table($border=0, $width="", $spacing="", $padding="", $args="") {
		$temp = "n<TABLE border=$border";
		if($width != "")
			$temp .= " width="$width"";
		if($spacing != "")
			$temp .= " cellspacing=$spacing";
		if($padding != "")
			$temp .= " cellpadding=$padding";
		if($args != "")
			$temp .= " $args";
		$temp .= ">n";
		print($temp);
	}

	function tr($args="") {
		$temp = "n<TR";
		if($args != "")
			$temp .= " $args";
		$temp .= ">n";
		print($temp);
		/* possible tr $args: id, class, lang, title, style, align, char, charoff, valign, intrinsic events */
	}

	function td($args="") {
		$temp = "n<TD";
		if($args != "")
			$temp .= " $args";
		$temp .= ">";
		print($temp);
		/* possible $args: id, class, lang, title, style, bgcolor, align, char, charoff, valign, rowspan, colspan, etc */
	}

	function table_close() {
		print("n</TABLE>n");
	}
?>

Search

Subscribe

  Rss Feeds

Sponsors

Advertise