Hi there.
Sorry if this has been asked a million times before >.>
I’m having a bit of trouble with my menu I understand the concept but in practice I keep stuffing it up. I’ve read through the documentation on the site “fun with menus” but I can’t seem to adapt it to what I’ve done so far.
It works fine, it was basically the menu code that’s provided in the starter kit plus an extra loop for children.
I understand that I need another loop between the middle list to:
- Check if visible
- Check if active
- Display child
But for what ever reason no matter what I write I get a lot of errors and I’m just a bit stuck so I appreciate any all a help.
<ul class="menu cf">
<?php foreach($pages->visible() as $p): ?>
<li>
<a <?php e($p->isOpen(), ' class="active"') ?> href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a>
<?php if($p->hasVisibleChildren()): ?>
<ul class="submenu">
<a href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a
<?php foreach($p->children()->visible() as $p): ?>
<li>
<a href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
</nav>