Skip to content

Instantly share code, notes, and snippets.

@hagatorn
Forked from bastianallgeier/menuAndSubmenu.php
Created May 9, 2013 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagatorn/5550636 to your computer and use it in GitHub Desktop.
Save hagatorn/5550636 to your computer and use it in GitHub Desktop.
<ul>
<?php foreach($pages->visible() AS $p): ?>
<li>
<a<?php echo ($p->isOpen()) ? ' class="active"' : '' ?> href="<?php echo $p->url() ?>"><?php echo html($p->title()) ?></a>
<?php if($p->children()->visible()->count()): ?>
<ul>
<?php foreach($p->children()->visible() AS $item): ?>
<li><a<?php echo ($item->isOpen()) ? ' class="active"' : '' ?> href="<?php echo $item->url() ?>"><?php echo html($item->title()) ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment