<?php
$json = <<<JSON
[{"title":"menu item","link":"#","active":"false","submenu":[{"title":"menu item","link":"#","active":"false"}]},{"title":"menu item","link":"#","active":"true","submenu":[]}]
JSON;
$menu_array = json_decode($json, true);
if (!empty($menu_array)) {
$html .= '<ul class="nav navbar-nav ' . $menuposition . '">';
foreach ($menu_array as $li) {
if (empty($li['submenu'])) {
$html .= '<li>'
. '<a href="' . $li['link'] . '" ' . ($li['active'] ? 'class="active"' : '') . '>'
. $li['title']
. '</a>'
. '</li>';
}
}
$html .= '</ul>';
}
preferences:
53.68 ms | 402 KiB | 5 Q