0
I need to create a dynamic menu where he creates the hierarchy according to Idmenupai but unfortunately I’m only able to list without hierarchy, someone could help me?
function montaMenuFilho($menu) {
echo '<ul class="dropdown-menu pull-left">';
foreach ($menu as $item) {
if(!empty($item->x )) {
echo '<li class="dropdown-submenu">
<a href="#">
<i class="icon-puzzle"></i>'.$item->Descricao.'</a>';
echo montaMenuFilho($item->Home);
echo '</li>';
} else {
if ($item->IdMenu == '27') {
echo '<li class=""><a href="'.$item->Url.'" title="Necessário logar na ferramenta Power BI.">'.$item->Descricao.'</a></li>';
} elseif ($item->IdMenu == '47') {
echo '<li class=""><a href="'.$item->Url.'" title="Apenas para acompanhamento da entrada de recursos.">'.$item->Descricao.'</a></li>';
} elseif ($item->IdMenu == '45') {
echo '<li class=""><a href="'.$item->Url.'" title="Painel em validação">'.$item->Descricao.'</a></li>';
} elseif ($item->IdMenu == '11' || $item->IdMenu == '23' || $item->IdMenu == '16' || $item->IdMenu == '17' || $item->IdMenu == '19' || $item->IdMenu == '12' || $item->IdMenu == '26') {
echo '<li class=""><a target="_blank" href="'.$item->Url.'">'.$item->Descricao.'</a></li>';
} else {
echo '<li class=""><a href="'.$item->Url.'">'.$item->Descricao.'</a></li>';
}
}
}
echo '</ul>';
}
?>
<ul class="nav navbar-nav">
<li class="">
<a href="http://10.31.40.74/novahome/">Home</a>
</li>
<?php
foreach ($menu as $item) {
if(!empty($item->Home)) {
echo '<li class="menu-dropdown classic-menu-dropdown">
<a data-hover="megamenu-dropdown" data-toggle="dropdown">
'.$item->Descricao.'<i class="fa fa-angle-down"></i>
</a>';
echo montaMenuFilho($item);
echo '</li>';
} else {
echo '<li class=""><a href="'.$item->Url.'">'.$item->Descricao.'</a></li>';
}
}
?>
</ul>
you need the listing to be according to an x number of hits on each menu item? specify your problem better.
– Senpai
Arthur I need to list the items of the idmenupai below the idmenu... example Item 1 has the idmenu 1 all items that have the idmenupai 1 need to enter below it, at the moment I can only list all items without specific order.
– Pablo JM