I need to show or hide a menu nav by checking the menu column == 1. But and
is not working. The following code returns nothing (not blank page). If I remove and ($AUTH->user->menu == '1')
it works. What am I doing wrong?
<nav id="primary-nav" class="menu-nav">
<?php if (($menu_nav) && ($AUTH->user->menu == '1')) { ?>
<ul>
<?php foreach ($menu_nav as $key => $link) {
$url = (isset($link['url']) && $link['url']) ? $link['url'] : '#';
$active = (isset($link['url']) && ($template['active_page'] == $link['url'])) ? ' class="active"' : '';
$icon = (isset($link['icon']) && $link['icon']) ? '<i class="' . $link['icon'] . '"></i>' : '';
$li_active = '';
if (isset($link['sub']) && $link['sub']) {
foreach ($link['sub'] as $sub_link) {
if (in_array($template['active_page'], $sub_link)) {
$li_active = ' class="active"';
break;
}
}
}
?>
<li<?php echo $li_active; ?>>
<a href="<?php echo $url; ?>"<?php echo $active ?>><?php echo $icon . $link['name']; ?></a>
<?php if (isset($link['sub']) && $link['sub']) { ?>
<ul>
<?php foreach ($link['sub'] as $sub_link) {
// Get vital info of sublinks
$url = (isset($sub_link['url']) && $sub_link['url']) ? $sub_link['url'] : '#';
$active = (isset($sub_link['url']) && ($template['active_page'] == $sub_link['url'])) ? ' class="active"' : '';
$icon = (isset($sub_link['icon']) && $sub_link['icon']) ? '<i class="' . $sub_link['icon'] . '"></i>' : '';
?>
<li>
<a href="<?php echo $url; ?>"<?php echo $active ?>><?php echo $icon . $sub_link['name']; ?></a>
</li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
</ul>
<?php } ?>
</nav>
Aucun commentaire:
Enregistrer un commentaire