Helper class useful to generate some html tags

author etessore
version 1.0.0
package classes

 Methods

Get the markup for an <a> tag

anchor(string $href, string $label, array $parms) : \the
Static

Parameters

$href

string

the url to be pointed

$label

string

the text

$parms

array

some html attributes in key=>value pairs or a plain string

Returns

\themarkup for an html tag

Gets the closing html tag for the given one

close_tag(string $tag) : string
InheritedStatic
inherited_from \HtmlBuilder::close_tag()

Parameters

$tag

string

the html tag

Returns

stringthe closing tag

Get the markup for a <div> tag

div(string $inner_html, array $parms) 
Static

Parameters

$inner_html

string

the inner html code

$parms

array

additional parameters

Retrieves the correct DOCTYPE

doctype() 
InheritedStatic
inherited_from \HtmlBuilder::doctype()

Get the markup for a <img> tag

image(string $src, array $parms) 
Static

Parameters

$src

string

the image source

$parms

array

additional parameters

Get the markup for a <input> tag

input(string $name, string $type, array $parms) : string
Static

Parameters

$name

string

the input name

$type

string

the input type, default text

$parms

array

additional parameters

Returns

stringhtml markup

Get the markup for a <label> tag

label(string $inner_html, string $for_name, array $parms) : string
Static

Parameters

$inner_html

string

the inner text

$for_name

string

the input name this label is referred to

$parms

array

additional parameters

Returns

stringhtml markup

Retrieves a <li> tag

list_item(string $inner_html, array $parms) 
Static

Parameters

$inner_html

string

the inner html

$parms

array

the optional attributes for the

  • Returns the <html> opening tag from html5 boilerplate

    open_html(string | array $class) 
    InheritedStatic
    inherited_from \HtmlBuilder::open_html()

    Parameters

    $class

    stringarray

    some additional classes

    Gets the opening html tag for the given one

    open_tag(string $tag, array $params) : string
    InheritedStatic
    inherited_from \HtmlBuilder::open_tag()

    Parameters

    $tag

    string

    the html tag

    $params

    array

    the additional parameters

    Returns

    stringthe opening tag

    Retrieves a <ol> tag

    ordered_list(string | array $inner_html, array $parms) 
    Static

    Parameters

    $inner_html

    stringarray

    the inner html. If is an array every element will be wrapped inside a

  • tag

  • $parms

    array

    the optional attributes for the

    <

    ol>

    Retrieves a <script> tag

    script(string $content, array $parms) 
    Static

    Parameters

    $content

    string

    the inner script content

    $parms

    array

    additional parameters

    Retrieves the list of self-closing tags

    self_closing_tags() : array
    InheritedStatic
    inherited_from \HtmlBuilder::self_closing_tags()

    Returns

    arraya list of self-closing tags

    Get the markup for a <span> tag

    span(string $inner_html, array $parms) 
    Static

    Parameters

    $inner_html

    string

    the inner html code

    $parms

    array

    additional parameters

    Builds a default tag structure: <tagname tagparameters>inner_html</tagname>

    standard_tag(string $tag, string $inner_html, array $parms) 
    InheritedStatic
    inherited_from \HtmlBuilder::standard_tag()

    Parameters

    $tag

    string

    the tag

    $inner_html

    string

    the inner html

    $parms

    array

    the additional html tag parameters

    Retrieves a <ul> tag

    unorderd_list(string | array $inner_html, array $parms) 
    Static

    Parameters

    $inner_html

    stringarray

    the inner html. If an array is passed, every element will be wrapped inside a

  • tag

  • $parms

    array

    the optional attributes for the

    <

    ul>

    Generates HTML Node Attribures

    array_to_html_attributes(string $glue, array | string $pieces) : string
    InheritedStatic
    author http://blog.teknober.com/2011/04/13/php-array-to-html-attributes/
    inherited_from \HtmlBuilder::array_to_html_attributes()

    Parameters

    $glue

    string

    $pieces

    arraystring

    Returns

    string

    Retrives the attributes list choosing between the given parameters

    get_html_attributes(string | array $inner_html, array $params) : string
    InheritedStatic
    inherited_from \HtmlBuilder::get_html_attributes()

    Parameters

    $inner_html

    stringarray

    the inner html

    $params

    array

    the parameters

    Returns

    stringthe html tag attributes ready to be printed in the DOM

    Prepare the $parms to be printed as html attributes

    params(array $parms) 
    InheritedStatic
    inherited_from \HtmlBuilder::params()

    Parameters

    $parms

    array

    list of html attributes

    Prepare the inner html for a list (ul\ol).

    list_inner_html(string | array $inner_html) 
    Static

    If it is a string it will be returnes as it is. If it is an array every element will be wrapped in a

  • tag

  • Parameters

    $inner_html

    stringarray

    the inner html

     Constants

     

    <p>value of the version of the html/xhtml used useful to have different behavior if not using HTML 5</p>

    HTML_VERSION : string
    Inherited
    inherited_from \HtmlBuilder::HTML_VERSION