$xml
$xml :
Progmatically create HTML structures using PHP objects.
__construct(mixed $xml, array $opts = array())
Build a new HTML\Element object.
| mixed | $xml | The tag name, or initial XML data. |
| array | $opts | Options for constructing the object. Options: 'parent' The parent Element object. If this is set, then the $xml parameter must be a simple tag name. 'content' Used if 'parent' is set, to optionally set the body content of the new tag. 'attrs' If set, this must be a PHP array. Associative members are name => value mapping. Flat (i.e. numerically indexed) members are boolean attributes to set (i.e. selected="selected" style.) If there is no 'parent' option, then the $xml variable can be in a few different formats: A simple tag name 'h1' An XML string ' |
__call( $tag, array $params)
Create a child HTML element.
| $tag | ||
| array | $params | Content and attributes. This __call function handles the magic of adding new children. Basically, any unknown method is assumed to be a child tag name. The parameters are handled depending on what they are. If a parameter is a string, it's considered body content. Multiple string parameters will be joined using newlines as a separator. If a parameter is an array, it's assumed to be a set of attributes. Multiple arrays will be joined using array addition. |
to_html( $opts = array())
Return the HTML string representing our element.
This strips the XML declarator, and trims the string.
It can optionally add an HTML doctype declarator. You can specify the declarator (the part after !DOCTYPE) as a string, or use one of the following numeric values:
4.0 HTML 4.01 Transitional -4.0 HTML 4.01 Strict 1.0 XHTML 1.0 Transitional -1.0 XHTML 1.0 Strict 1.1 XHTML 1.1 -1.1 XHTML 1.1 (alias) 5.0 HTML 5 -5.0 HTML 5 (alias)
The only number that requires a decimal value is 1.1, the rest the decimal place is optional and only included for formatting.
| $opts |