-
Notifications
You must be signed in to change notification settings - Fork 20
Creating a HTML Menu
Thomas Weinert edited this page Jul 12, 2018
·
4 revisions
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>
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces