下拉菜单将PHP代码引导至大型菜单 我有一个带有此导航菜单的网站,它是我想要的普通菜单 这是我的代码
<div class="navRight">
<ul class="nav nav-tabs ">
<?php
$category = DB::table('categories')->orderBy('order', 'ASC')->orderBy('id', 'DESC')->get();
foreach($category as $item):
$hasSub = false;
foreach($category as $nitem):
if($nitem->parentID == $item->id) {
$hasSub = true;
break;
}
endforeach;
if ($item->parentID == 0 ){ ?>
<li role="presentation" class="<?= ($hasSub)? 'dropdown' : '';?> ">
<a <?= ($hasSub)? 'class="dropdown-toggle"' : '';?> href="<?php if($item->url_slug != "home"): echo '/category/' . $item->url_slug; else: echo '/'; endif; ?>">
<?= ucwords($item->name) ?>
<?php if ($hasSub): ?>
<span class="caret"></span>
<?php endif ?>
</a>
<?php }
if ($hasSub) {
echo '<ul class="dropdown-menu dropfixed">';
foreach ($category as $value) :
if ($value->parentID == $item->id):
echo '<li><a href="/category/'. $value->url_slug .'">'.ucwords($value->name).'</a></li>';
endif;
endforeach;
echo '</ul>';
}?>
</li>
<?php endforeach; ?>
</ul>
<div class="mobile-menu menu_open"><i class="fa fa-bars"></i><i class="fa fa-times"></i></div>
<div class="searchIcon" data-toggle="modal" data-target=".search_popup"><a href="javascript:void(0)"><i class="glyphicon glyphicon-search"></i></a></div>
</div>
my look in nav bar menu website its normal
我希望代码给我This Look
我想要的是大型菜单2列或3列,或者旁边的li看起来不像我的代码,因为当我添加更多类别时会很糟糕