anyway to better control the page listed with auto-nav?

Permalink
For example, I have an "About Us" Page with some relevant pages under it. In the URL my pages would look nicely like this


web.com/about
web.com/about/history
web.com/about/goals
web.com/about/directors

Now, I want to use auto-nav to list those 4 pages on the side bar. But if I choose to display child level, I get the bottm 3. If I choose parent level, I get about us and a bunch of other pages on its level. Is there a way to get the 4 pages displayed together in a unifying way? I mean

- about
- history
- etc

not different level like this

- about
---- history
---- etc

Any suggestion?

 
jbx replied on at Permalink Reply
jbx
Could you just alter the CSS, so that it displays the nested menu in the same way as the top level menu? And then if you didn't want the other pages to appear in the nav, just check the attribute "exclude from nav" on those pages. Does that make sense?

Jon
Panupat replied on at Permalink Reply
If I include the parent level, I'm getting other pages I don't want too. Kinda like

- Home
- About us ( I only want this)
---- sub pages
---- sub pages
- service
- contact
- etc
- etc

For example. Since these links are secondary links, I only want it to display the set of pages I want.

I can kinda get around this using HTML to create the links myself, but would really love to know a way around this.
jbx replied on at Permalink Reply
jbx
Ok, and I'm assuming you don't want to use the "Exclude from nav" attribute on Home, Contact etc. as you want these links to show up on another menu right?

Well, in that case you need a custom autonav template. Give me a short while and I'll put one together for you...

Jon
jbx replied on at Permalink Best Answer Reply
jbx
I'm making a few assumptions here:
1) You're using the standard autonav (not a custom template)
2) You just want to modify the display on the subpages, so if you go to about/history, the menu will show:
about
history
goals
directors

create the following folders under /blocks:
autonav/templates
Inside templates, create a new file (called subnav.php or similar) and copy and paste the contents of /concrete/blocks/autonav/view.php inside it.

Look inside this file and find the following bit of code:
if ($c->getCollectionID() == $_c->getCollectionID()) {
    echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() . '</a>');
} elseif (in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
    echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '" ' . $target . '>' . $ni->getName() . '</a>');
} else {
    echo('<li><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');
}
$lastLevel = $thisLevel;
$i++;


and wrap it in an if statement, so you end up with this:
if ($_c->getCollectionID() == $selectedPathCIDs[1] || $_c->cParentID == $selectedPathCIDs[1]) {
    if ($c->getCollectionID() == $_c->getCollectionID()) {
        echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() . '</a>');
    } elseif (in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
        echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '" ' . $target . '>' . $ni->getName() . '</a>');
    } else {
        echo('<li><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');
    }
    $lastLevel = $thisLevel;
    $i++;
}


Think that's right. If you also want the same custom nav on the about page, you will need to crete a copy of that template with a new name and change that if statement at the start to read:
if ($_c->getCollectionID() == $selectedPathCIDs[0] || $_c->cParentID == $selectedPathCIDs[0]) {


Does any of that make sense??

Jon
Panupat replied on at Permalink Reply
Thanks jbx :) I'm going to try it out now. Have always wanted to learn the concept of custom templates. I will let you know how it turns out.
Panupat replied on at Permalink Reply
edit - sorry, after I play around with the settings, everything seem to work now! :) Thank you very much.

Also, I've been wondering how the custom template works for a while. Your instruction really strikes me and help me understand a ton more about them. More thanks to you jbx
jbx replied on at Permalink Reply
jbx
Glad I could help :)
Panupat replied on at Permalink Reply
I'm getting something weird. Both pages below are using the same auto-nav settings with the same custom-template.

http://www.dolphinstudytour.com/about...
http://www.dolphinstudytour.com/studytour...

/about is acting correctly.
/studytour, I'm getting a lot of nesting <ul> over and over.

Any idea what might have caused this?