Creating a HTML Menu - ThomasWeinert/FluentDOM GitHub Wiki
FluentDOM provides some shortcut functions to create nodes. The following examples shows how to use them to create HTML by creating a menu.
$document = new FluentDOM\DOM\Document();
// add the base menu node
$menu = $document->appendElement('ul', ['class' => 'navigation']);
// step 2
// output the created ul element as html
echo $document->documentElement->saveHtml();
<ul class="navigation"></ul>
// add the first menu item
$menu
->appendElement('li')
->appendElement('a', 'Sample', ['href' => '/sample.php']);
// add the second menu item
$menu
->appendElement('li')
->appendElement('a', 'FluentDOM', ['href' => 'http://fluentdom.org']);
<ul class="navigation">
<li><a href="/sample.php">Sample</a></li>
<li><a href="http://fluentdom.org">FluentDOM</a></li>
</ul>