Sidebar Menu Display Issues

Permalink
I have another issue related to the one I outlined in this thread here:

http://www.concrete5.org/community/forums/customizing_c5/dynamic-su...

I want to have my sidebar menu be dynamic enough so I don't have to add one to every level of subpages, and I can't seem to get it to work.

My auto nav is set up like this:

Pages Should Appear->In their sitemap order
Display Pages->At the level below
Sub-Page Levels->Display Subpages to Current+1

This works as expected when I'm on my Top Level pages, the sidebar menu displays only the pages underneath that Top Level Page.

However, when I click down to a third level page, I want the menu to display the other sibling pages at this same level...which is does not do. It doesn't display anything at all.

Is there a way to do this?

leinteractive
 
olliephillips replied on at Permalink Reply
olliephillips
Had the same issue today, but single page related. You might be able to adapt this to your page type. This is working for me.

## Submenu
$parentId =  $c->getCollectionParentID();
$pageLevel = 0;
while ( $parentId > 0 ) {
   $pageLevel++;
   $collection = Page::getById($parentId);
   $parentId = $collection->getCollectionParentID();
}
$an = BlockType::getByHandle('autonav');
if ($pageLevel == 1) {
   // Autonav for items below
   $an->controller->displayPages = 'below';
} else {
   // Autonav for current level
   $an->controller->displayPages = 'current';
leinteractive replied on at Permalink Reply
leinteractive
Where did you put this code? Is it in your AutoNav template or are you hardcoding the AutoNav into your theme file?
olliephillips replied on at Permalink Reply
olliephillips
I'm using in my themes view.php file.
leinteractive replied on at Permalink Reply
leinteractive
Hmm...is there a way to make this work inside an autonav template?

I have several pages on my site that do not need the menu on the sidebar...so to have it hardcoded means I can't go and remove it while in Edit Mode.
olliephillips replied on at Permalink Reply
olliephillips
You could do this in a "page type" of your theme. Then apply the page type to the pages where you need the menu on the side bar.

Hope that helps.
leinteractive replied on at Permalink Reply
leinteractive
Yea, I thought about that...it's just so cumbersome given that the pages that need the menu and those that don't are sporadically placed throughout the sitemap.