class Html

Class Html

Methods

static string
createElement(string $tagName = 'div', string $content = '', null $attributes = NULL)

Statically creates an html element string.

static string
createAttribute($name, $value)

Statically create an attribute.

static string
renderNode(Html $el)

Renders an instance of Html.

__construct(string $tagName = 'div', string $content = '')

Html constructor.

id($id)

Define the element's id attribute.

string|void
getId()

No description

addClass($className)

Add a single class to an element.

addClasses(array $classList)

Add an array of classes to an element.

addAttribute($name, $value)

Add an attribute to an element.

addAttributes(array $attributeList)

Add an array of attributes to an element.

addStyle($name, $value)

Add a style to an element.

addStyles(array $styleList)

Add an array of styles to an element.

string|void
getStyles()

No description

append($newContent)

Append content to the elements content body.

prepend($newContent)

Prepend content to the element's content body.

setContent($newContent)

Initialize the element's content body.

newChild(string $tagName = 'div', string $content = '')

Instantiates a new element instance, pushes it on to the parent's array of children, and returns the newly created child instance.

string
renderChildren()

Render the child elements (recursive).

string
render()

Render the element object to an html string.

string
__toString()

No description

Details

at line line 49
static string createElement(string $tagName = 'div', string $content = '', null $attributes = NULL)

Statically creates an html element string.

Parameters

string $tagName
string $content
null $attributes

Return Value

string

at line line 75
static string createAttribute($name, $value)

Statically create an attribute.

Just returns the attribute string.

Parameters

$name
$value

Return Value

string

at line line 95
static string renderNode(Html $el)

Renders an instance of Html.

Used for recursively rendering instances with children.

Parameters

Html $el

Return Value

string

at line line 106
__construct(string $tagName = 'div', string $content = '')

Html constructor.

Parameters

string $tagName
string $content

at line line 119
Html id($id)

Define the element's id attribute.

Parameters

$id

Return Value

Html $this

at line line 129
string|void getId()

Return Value

string|void

at line line 146
Html addClass($className)

Add a single class to an element.

Parameters

$className

Return Value

Html $this

at line line 163
Html addClasses(array $classList)

Add an array of classes to an element.

Parameters

array $classList

Return Value

Html $this

at line line 193
Html addAttribute($name, $value)

Add an attribute to an element.

Parameters

$name
$value

Return Value

Html $this

at line line 207
Html addAttributes(array $attributeList)

Add an array of attributes to an element.

Parameters

array $attributeList

Return Value

Html $this

at line line 240
Html addStyle($name, $value)

Add a style to an element.

Parameters

$name
$value

Return Value

Html $this

at line line 254
Html addStyles(array $styleList)

Add an array of styles to an element.

Parameters

array $styleList

Return Value

Html $this

at line line 267
string|void getStyles()

Return Value

string|void

at line line 286
Html append($newContent)

Append content to the elements content body.

Parameters

$newContent

Return Value

Html $this

at line line 300
Html prepend($newContent)

Prepend content to the element's content body.

Parameters

$newContent

Return Value

Html $this

at line line 314
Html setContent($newContent)

Initialize the element's content body.

Parameters

$newContent

Return Value

Html $this

at line line 331
Html newChild(string $tagName = 'div', string $content = '')

Instantiates a new element instance, pushes it on to the parent's array of children, and returns the newly created child instance.

Parameters

string $tagName
string $content

Return Value

Html

at line line 344
string renderChildren()

Render the child elements (recursive).

Return Value

string

at line line 354
string render()

Render the element object to an html string.

Return Value

string

at line line 375
string __toString()

Return Value

string