Hello,
I'm trying to implement a sidebar / sub nav on my pages, the site is only 2 deep currently and what happens with my code below is on the parent page it's pulling in the parent site pages, what I am trying to achieve is the display of the child pages of the active page, then when in a child page it should maintain the other child pages of that parent. Does that make sense?
If I use childof @current instead I can achieve the direed sub nav at parent level, but clicking into a child shows no menu because there are no children for that page.
I was wondering if there is a way to conditionally use childof and root, something like:
Perhaps there is a simpler / better approach I have overlooked?
I'm trying to implement a sidebar / sub nav on my pages, the site is only 2 deep currently and what happens with my code below is on the parent page it's pulling in the parent site pages, what I am trying to achieve is the display of the child pages of the active page, then when in a child page it should maintain the other child pages of that parent. Does that make sense?
- Code: Select all
<div class="visible-desktop visible-tablet">
<ul class="nav nav-pills nav-stacked">
<cms:nested_pages masterpage='pages.php' root='@current-1' depth='0'>
<li<cms:if k_is_active && k_level !='0'> class="active"</cms:if>><a href="<cms:show k_nestedpage_link />"><cms:show k_nestedpage_title /></a></li>
</cms:nested_pages>
</ul>
</div>
If I use childof @current instead I can achieve the direed sub nav at parent level, but clicking into a child shows no menu because there are no children for that page.
I was wondering if there is a way to conditionally use childof and root, something like:
<cms:if nested_page_depth ='0'>
<cms:nested_pages masterpage='pages.php' childof='@current' depth='0'>
<cms:else>
<cms:nested_pages masterpage='pages.php' root='@current-1' depth='0'>
</cms:if>
Perhaps there is a simpler / better approach I have overlooked?