We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Structure Module: Sub Nav: Hide Siblings

Development and Programming

JohnGribben's avatar
JohnGribben
111 posts
16 years ago
JohnGribben's avatar JohnGribben

Hi,

I am using the Structure module for a site that will have about four levels of navigation. Is there any way to configure the nav_sub tag so that it will only display children of the current page if any are present? I thought it was supposed to show only the children of a page. According to Travis, in a response to a comment in February, that is how it is supposed to function:

It shows the children of a page when you are on that page…

On my site, though: if a page has children, the tag will display them, but if the page doesn’t have children, the tag shows the current page and it’s siblings.

This is how I am setting it for the third level:

{if segment_3 != ""}

{exp:structure:nav_sub start_from="/{segment_1}/{segment_2}/{segment_3}" limit_depth="1"}

{/if}

I would like the siblings to be hidden and just to show ONE level of children.

Thanks, John

       
rockthenroll's avatar
rockthenroll
485 posts
16 years ago
rockthenroll's avatar rockthenroll

The proper parameter is show_depth. I’m not following: what you explain sounds correct… can you try using the right parameter and see if it behaves as needed?

       
JohnGribben's avatar
JohnGribben
111 posts
16 years ago
JohnGribben's avatar JohnGribben

Thank you for your reply, Travis. I changed the parameter as you recommended. I am still having the problem. I beg your pardon that I was so unclear. I am using this now:

{if segment_3 != ""}

{exp:structure:nav_sub start_from="/{segment_1}/{segment_2}/{segment_3}/" show_depth="0"}

{/if}

I am dealing with this hierarchy:

What is Asthma? Definition of Asthma Asthma Management Asthma Management Checklist Medical Treatment of Asthma Immunological Treatments for Asthma Using Special Devices

I wanted to show only the navigation for children. This works for the first three items. If you are on “What is Asthma?” you see the link to “Definition of Asthma” etc.

But if you go to “Using Special Devices,” which has no children, you see the siblings:

What is Asthma? Asthma Management Medical Treatment of Asthma Using Special Devices

I was hoping to make the sub-navigation disappear on pages with no children.

Thanks again for your help! John

       
rockthenroll's avatar
rockthenroll
485 posts
16 years ago
rockthenroll's avatar rockthenroll

@JohnGribben Got you. Yes, that’s the intended behavior, as I feel it would be worse from a usability standpoint to make the sub navigation disappear and strand the user. It maintains a “here” state and keeps the user aware of where they are. If you really need to get rid of it, you could use segment checking to remove the tag for that page, but in my opinion I’d leave it.

       
JohnGribben's avatar
JohnGribben
111 posts
16 years ago
JohnGribben's avatar JohnGribben

Thanks for your reply. I see what you mean.

That is what we are doing – using segment checking to determine where it will appear.

Take care, John

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.