HtmlElement
class HtmlElement implements ArrayAccess, IteratorAggregate
HTML helper.
usage: $anchor = (new HtmlElement('a'))->href($link)->setText('Texy'); $el->class = 'myclass';
echo $el->startTag(), $el->endTag();
Properties
array | $attrs | ||
static bool | $xhtml | ||
static array | $emptyElements | ||
static array | $inlineElements | ||
static array | $optionalEnds | ||
static | $prohibits | ||
protected array | $children |
Methods
No description
No description
Changes element's name.
Returns element's name.
Is element empty?
Overloaded setter for element's attribute.
Overloaded getter for element's attribute.
Special setter for element's attribute.
Sets element's textual content.
Gets element's textual content.
Adds new element's child.
Creates and adds a new HtmlElement child.
Inserts child node.
Inserts (replaces) child node (ArrayAccess implementation).
Returns child node (ArrayAccess implementation).
Exists child node? (ArrayAccess implementation).
Removes child node (ArrayAccess implementation).
Required by the Countable interface.
Removed all children.
Required by the IteratorAggregate interface.
Returns all of children.
Returns element's start tag.
Returns element's end tag.
Clones all children too.
No description
No description
No description
Details
at line 83
__construct($name = null, $attrs = null)
No description
at line 94
static
el($name = null, $attrs = null)
No description
at line 107
final HtmlElement
setName($name, $empty = null)
Changes element's name.
at line 123
final string
getName()
Returns element's name.
at line 133
final bool
isEmpty()
Is element empty?
at line 145
final void
__set($name, $value)
Overloaded setter for element's attribute.
at line 156
final mixed
__get($name)
Overloaded getter for element's attribute.
at line 186
final HtmlElement
href($path, $query = null)
Special setter for element's attribute.
at line 204
final HtmlElement
setText($text)
Sets element's textual content.
at line 220
final string
getText()
Gets element's textual content.
at line 238
final HtmlElement
add($child)
Adds new element's child.
at line 250
final HtmlElement
create($name, $attrs = null)
Creates and adds a new HtmlElement child.
at line 265
HtmlElement
insert($index, $child, $replace = false)
Inserts child node.
at line 289
final void
offsetSet($index, $child)
Inserts (replaces) child node (ArrayAccess implementation).
at line 300
final mixed
offsetGet($index)
Returns child node (ArrayAccess implementation).
at line 311
final bool
offsetExists($index)
Exists child node? (ArrayAccess implementation).
at line 322
void
offsetUnset($index)
Removes child node (ArrayAccess implementation).
at line 334
final int
count()
Required by the Countable interface.
at line 344
void
removeChildren()
Removed all children.
at line 354
final ArrayIterator
getIterator()
Required by the IteratorAggregate interface.
at line 364
final
getChildren()
Returns all of children.
return array
at line 374
final string
toString(Texy $texy)
Renders element's start tag, content and end tag to internal string representation.
at line 402
final string
toHtml(Texy $texy)
Renders to final HTML.
at line 412
final string
toText(Texy $texy)
Renders to final text.
at line 422
string
startTag()
Returns element's start tag.
at line 489
string
endTag()
Returns element's end tag.
at line 501
__clone()
Clones all children too.
at line 514
final int
getContentType()
No description
at line 527
final void
validateAttrs(array $dtd)
No description
at line 542
validateChild($child, $dtd)
No description
at line 561
final void
parseLine(Texy $texy, $s)
Parses text as single line.
at line 576
final void
parseBlock(Texy $texy, $s, $indented = false)
Parses text as block.
Traits
Better OOP experience.