Public Member Functions | Static Public Member Functions | Data Fields
Tag Class Reference

Html tag. More...

Inheritance diagram for Tag:
Form

Public Member Functions

 Tag ($type, $attributes=array())
 
 getType ()
 
 getAttribute ($name)
 
 getAttributes ()
 
 hasAttribute ($name)
 
 setAttribute ($attribute, $value= '')
 
 append ($content=array())
 
 appendTo (Tag $tag)
 
 getChildren ()
 
 html ($indent=-1)
 
 indent ($indent=-1)
 
 __toString ()
 

Static Public Member Functions

static newInstance ($type, $attributes=array())
 

Data Fields

 $type
 
 $attributes = array()
 
 $content = array()
 

Detailed Description

Html tag.

Version
1.2
Author
DinuSV

Member Function Documentation

Tag (   $type,
  $attributes = array() 
)

Constructor

Parameters
string$type: type of the tag
array$attributes: [optional] attributes for the tag
static newInstance (   $type,
  $attributes = array() 
)
static

Static constructor to support chaining

Parameters
string$type
array$attributes
See Also
Tag/constructor
getType ( )

Get channel type

Returns
string
getAttribute (   $name)

Get the value of an attribute for this Tag

Parameters
string$name: name of the attribute
Returns
string : the value of the attribute
null : in case the attribute cannot be found
getAttributes ( )

Get all attributes

Returns
array
hasAttribute (   $name)

Check if an attribute exists for this tag

Parameters
string$name: name of the attribute
Returns
boolean : true if the attribute exists, false otherwise
setAttribute (   $attribute,
  $value = '' 
)

Set an attribute or add a set of attributes

Parameters
array$attribute: attributes to set as a hashmap
string$attribute: name of the attribute
string$value: [optional] the value for a single attribute
Returns
Tag : current object
append (   $content = array())

Append content to this tag. This can be either another tag or a string value

Parameters
array$content: append an array of tags and strings to this tag
string$content: append a text to this tag
Tag$content: append a Tag child
Returns
Tag : current object
appendTo ( Tag  $tag)

Append this tag to another one

Parameters
Tag$tag: the tag to append to
Returns
Tag : current object
getChildren ( )

Get the current tags children

Returns
array
html (   $indent = -1)

Get the html content for this tag

Parameters
integer$indent: [optional] in case you need to use indentation, set this to 0, or to the number of tabs you want to start indenting at
Returns
string
indent (   $indent = -1)

Get this object and it's html string representation

Parameters
int$indent: [optional] in case you need to use indentation, set this to 0, or to the number of tabs you want to start indenting at
Returns
string
__toString ( )

Tostring method

Returns
string

Field Documentation

$type

string : Tag type

$attributes = array()

array : Tag Attributes

$content = array()

array : Tag content