| 
<?php
 /**
 * @author Tony Frezza
 * @copyright 2017
 */
 
 include('html.php');
 
 
 $html = new Html;
 
 
 /**
 En:
 Once the id tag is not entered, the class will automatically generate an id.
 Every time a node is added, the add method returns the id, whether it is entered from the id tag or not.
 It is possible to add a child node to a parent node, informing the id of the parent node
 
 Pt-BR:
 Uma vez que não seja informada a tag id, a classe se encarrega de gerar uma id automaticamente.
 Toda vez que um nó é adicionado, o metodo add retorna a id, seja ela informada a partir da tag id ou não.
 É possível adicionar um nó filho a um nó pai, informando a id do nó pai
 */
 
 
 
 $idNodeParent = $html->add(
 array(
 'tag'   =>  'ul'
 )
 );
 
 $html->add(
 array(
 'tag'       =>  'li',
 'text'      =>  'foo',
 'parent_id' =>  $idNodeParent,
 )
 );
 
 $html->add(
 array(
 'tag'       =>  'li',
 'text'      =>  'bar',
 'parent_id' =>  $idNodeParent,
 )
 );
 
 echo $html->getHtml();
 
 $html->resetHtml();
 
 
 $idContainer = $html->add(
 array(
 'tag'       =>  'div',
 'style'     =>  'width: 100%; border: solid; text-align: center;',
 )
 );
 
 $html->add(
 array(
 'tag'       =>  'div',
 'style'     =>  'width:100%; height: 20px; background: red;',
 'text'      =>  'Child DIV node with style attribute',
 'parent_id' =>  $idContainer,
 )
 );
 
 $html->add(
 array(
 'tag'       =>  'div',
 'style'     =>  'width:100%; height: 30px; background: blue;',
 'text'      =>  'Child DIV node with style attribute',
 'parent_id' =>  $idContainer,
 )
 );
 
 echo $html->getHtml();
 ?>
 |