Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created May 2, 2012 07:29
Show Gist options
  • Save bastianallgeier/2574798 to your computer and use it in GitHub Desktop.
Save bastianallgeier/2574798 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>
@milojennings
Copy link

Awesome, thanks!

@johnevanofski
Copy link

yes perfect. IMO should be included in the downloads section!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment