Location: PHPKode > scripts > Tab > tab/tab_simples.php
<?php

class Tab 
{
	var $bgcolor;
	var $align;
	var $width;
	var $names;
	var $hrefs;
	
	function Tab( $bgcolor = "#ccccff", $align = "center", $width = "99%")
	{
			$this->bgcolor = $bgcolor;
			$this->align = $align;
			$this->width = $width;
			$this->names = "";
			$this->hrefs = "";
	}
	
	function AddTab ( $name , $href )
	{
			$this->names[] = $name;
			$this->hrefs[] = $href;
	}
	
	function Show ()
	{
			$str = "<table width=\"".$this->width."\"> <tr><td bgcolor=\"". $this->bgcolor ."\" align=\"".$this->align."\"><b>";

	   if ( sizeof ($this->names) > 1 )
	   	for ($i = 0; $i < sizeof ($this->names) - 1; $i++)
	      $str = $str . "<a href=\"" . $this->hrefs[$i] . "\" target=\"_top\">" . $this->names[$i] . "</a> | "; 
	   
	   $str = $str . "<a href=\"" . $this->hrefs[$i] . "\" target=\"_top\">" . $this->names[$i] . "</a>";
	   $str = $str . "</b></td></tr></table>";
	   
	   return $str;

	}
	
	function Clear ()
	{
			$this->names = "";
			$this->hrefs = "";
	}
	
	function SetWidth ($width)
	{
			$this->width = $width;
	}
	
	function GetWidth ()
	{
			return $width;
	}
	
	function SetBgColor($bgcolor)
	{
			$this->bgcolor = $bgcolor;
	}
	
	function GetBgColor($bgcolor)
	{
			return $bgcolor;
	}
	
	function SetAlign($align)
	{
			$this->align = $align;
	}
	
	function GetAlign()
	{
			return $align;
	}
}

$t = new Tab;

$t->AddTab("Ricardo","http://www.google.com");
$t->AddTab("Rudolfo","http://www.yahoo.com");

echo $t->Show();

?>
Return current item: Tab