<?php
/**
* Title: Superclass for all the html tags.
* @description: The baseclass for all html tags.
* @author Oddleif Halvorsen | leif-hide@address.com
* @version 1.0
*/
class HTMLTag{
//Variables in commen for (almost) all HTML tags.
var $id;
var $class;
var $title;
var $style;
/**
* Constructor that instansiate alle the local variables.
*/
function HTMLTag(){
$this->id = NULL;
$this->class = NULL;
$this->title = NULL;
$this->style = NULL;
}
function setId($id){ $this->id = $id; }
function setClass($class){ $this->class = $class; }
function setTitle($title){ $this->title = $title; }
function setStyle($style){ $this->style = $style; }
function getId(){ return (isset($this->id) ? $this->id : FALSE); }
function getClass(){ return (isset($this->class) ? $this->class : FALSE); }
function getTitle(){ return (isset($this->title) ? $this->title : FALSE); }
function getStyle(){ return (isset($this->style) ? $this->style : FALSE); }
/**
* Returns the html attributes that is set
* @return A text string with the attributes on the form: ' attribute="value" attribute="value"'
*/
function getAttributes(){
$attributes;
if($this->getId())
$attributes .= " id=\"" . $this->getId() . "\"";
if($this->getClass())
$attributes .= " class=\"" . $this->getClass() . "\"";
if($this->getTitle())
$attributes .= " title=\"" . $this->getTitle() . "\"";
if($this->getStyle())
$attributes .= " style=\"" . $this->getStyle() . "\"";
return (isset($attributes) ? $attributes : FALSE);
}
}
?>