Sledgehammer Framework

Html extends Base
in package

Html, a view compatible class for rendering raw html.

Contains static helper functions for generating tags, etc.

Table of Contents

$headers  : array<string|int, mixed>
The View headers.
$html  : string
The output string.
__call()  : mixed
Report that the $method doesn't exist.
__callStatic()  : mixed
Report that the $method doesn't exist.
__construct()  : mixed
Constructor.
__get()  : mixed
Report that $property doesn't exist.
__set()  : mixed
Report that $property doesn't exist and set the property to the given $value.
__toString()  : string
Returns the html.
element()  : Html
Generate a HTML element.
escape()  : string
htmlentities() using the current charset.
getHeaders()  : array<string|int, mixed>
Return View headers.
icon()  : Html
Build an icon tag <img class="icon" /> or <span class="glyphicon glyphicon-*"></span>.
render()  : mixed
Output the html.

Properties

$headers

The View headers.

private array<string|int, mixed> $headers

$html

The output string.

private string $html

Methods

__call()

Report that the $method doesn't exist.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__callStatic()

Report that the $method doesn't exist.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

Constructor.

public __construct(string $html[, array<string|int, mixed> $headers = [] ]) : mixed
Parameters
$html : string
$headers : array<string|int, mixed> = []
Return values
mixed

__get()

Report that $property doesn't exist.

public __get(string $property) : mixed
Parameters
$property : string
Return values
mixed

__set()

Report that $property doesn't exist and set the property to the given $value.

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Return values
mixed

__toString()

Returns the html.

public __toString() : string

Allows echo $html;.

Return values
string

element()

Generate a HTML element.

public static element(string $name, array<string|int, mixed> $attributes[, bool|string|array<string|int, mixed> $contents = '' ]) : Html
Parameters
$name : string

Name of the element. Example "div", "img", "script", etc

$attributes : array<string|int, mixed>

array('type'=> 'checkbox', 'checked' => true, 'disabled')

$contents : bool|string|array<string|int, mixed> = ''

true: Only generate the opentag, string html, array with sub elements

Return values
Html

escape()

htmlentities() using the current charset.

public static escape(string $text[, int $flags = ENT_COMPAT ]) : string
Parameters
$text : string
$flags : int = ENT_COMPAT

ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES, ENT_IGNORE , ENT_SUBSTITUTE, ENT_DISALLOWED, ENT_HTML401, ENT_XML1, ENT_XHTML, ENT_HTML5

Return values
string

getHeaders()

Return View headers.

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

render()

Output the html.

public render() : mixed
Return values
mixed

Search results