Skip to content

Instantly share code, notes, and snippets.

@timkelty
Created July 26, 2010 21:01
Show Gist options
  • Select an option

  • Save timkelty/491240 to your computer and use it in GitHub Desktop.

Select an option

Save timkelty/491240 to your computer and use it in GitHub Desktop.
{exp:structure_entries
parent="/{segment_1}/{segment_2}/"
depth="2"}
{if {depth} == 1}
{if {count} == 1}<ul class="nav-side">{/if}
<li class="entry-{entry_id}{if {current_page}} active{/if}{if {current_parent}} parent-active{/if}{if {count} == 1 && embed:first_class != "no"} first{/if}{if {last_child} == 1 && embed:last_class != "no"} last{/if}">
<a href="{page_uri}" rel="{if cf_pages_redirects_new}window{/if} {if cf_pages_redirect_warning}warning{/if}">{hidden_snippets_title}</a>
{if {children_total} == 0}{!-- No Children - so close markup --}
</li>
{/if}
{if:else}{!-- Children (not top level) --}
{if {sibling_count} == 1}{!-- First child - so open markup --}
<ul class="level-{depth}">
{/if}
<li class="entry-{entry_id}{if {current_page}} active{/if}{if {current_parent}} parent-active{/if}{if {sibling_count} == 1 && embed:first_class != "no"} first{/if}{if {last_sibling} == 1 && embed:last_class != "no"} last{/if}">
<a href="{page_uri}" rel="{if cf_pages_redirects_new}window{/if} {if cf_pages_redirect_warning}warning{/if}">{hidden_snippets_title}</a>
{close_markup}
{if {total_children} == 0}
</li>
{/if}
{if {last_sibling} && {sibling_count} == {sibling_total}}
</ul><!-- End of level{depth} closing tags -->
</li>
{/if}
{/close_markup}
{/if}
{if {depth} == 1}
{if {last_sibling} && {sibling_count} == {sibling_total}}</ul>{/if}
{/if}
{/exp:structure_entries}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment