Login   Register  
PHP Classes
elePHPant
Icontem

File: gallery.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of bmpc  >  Gallery  >  gallery.php  >  Download  
File: gallery.php
Role: ???
Content type: text/plain
Description: The core code
Class: Gallery
This class creates a table "gallery" from an array
Author: By
Last change:
Date: 12 years ago
Size: 917 bytes
 

Contents

Class file image Download
<?

class gallery {

	var $a_data;
	var $n_border;

	var $n_debug;
	var $s_message;


	//
	//	gallery
	//

	function gallery ( $n_debug = 0, $s_message = "Array is empty" ) {
		$this->n_debug = $n_debug;
		$this->s_message = $s_message;
	}

	//
	//	show
	//
	//		displays table with the data array
	//

	function show ( $a_data, $n_border = 0, $n_max = 5, $s_bg_color = "FFFFFF" ) {

		$this->a_data = $a_data;
		$this->n_border = $n_border;

		if ( sizeof ( $this->a_data ) > 0 ) {

			echo "<table border=$n_border bgcolor=$s_bg_color>\n";
			echo "<tr>\n";

			$i = 1;
			foreach ( $this->a_data as $content ) {
				echo "<td>", $content, "</td>\n";

				if ( ( $i % $n_max ) == 0 ) {
					echo "</tr><tr>\n";
				}

				$i++;
			}

			echo "</tr>";
			echo "</table>";

		}
		else if ( $this->n_debug <> 0 ) {
			echo "<br>", $this->s_message;
		}
	}

}