Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Vert Nav 2nd level issue.


Reply


8 Posts   3725 Views

Avatar
dancrew32

Community Member, 15 Posts

5 April 2008 at 8:59am

So I'm trying to setup a multi-level vertical nav that only displays the children of the page that it's on.

The issue: with the code below, if you navigate to one of the second level pages, all the children in the vertical nav will go away. I want all of the 2nd level links to continue being displayed when you're on 2nd level pages.

In my navigation.ss file:

<ul>
   <% control Menu(1) %>
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle</span></a>
         <% if isSection %>
            <% control Children %>
               <ul class="lvl2">
                  <li class="lvl2"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a></li>
               </ul>
            <% end_control %>
         <% end_if %>
      </li>
   <% end_control %>
</ul>   

Any ideas would be greatly appreciated. =]

Avatar
contigo

Community Member, 16 Posts

6 April 2008 at 12:36pm

Edited: 06/04/2008 1:11pm

I've been playing with submenus too. Try replacing

<% if isSection %>

with

<% if LinkOrSection = section %>

-billy

Avatar
dancrew32

Community Member, 15 Posts

8 April 2008 at 3:06am

Edited: 08/04/2008 3:07am

As that works, I think the problem with my code is that when you navigate to the 2nd level page, it's looking for <% control Children %> so it starts looking for 3rd level children (which don't exist, so it displays nothing). What might be a work-around for this?

Avatar
contigo

Community Member, 16 Posts

8 April 2008 at 2:44pm

maybe this...

             <% if LinkOrSection = section %>
                <% if Children %>

Avatar
dancrew32

Community Member, 15 Posts

9 April 2008 at 7:07am

see I think by saying if Children it's still looking for 3rd level children when you're on a 2nd level page.. kinda frustrating lol..

Avatar
contigo

Community Member, 16 Posts

10 April 2008 at 10:55am

"see I think by saying if Children it's still looking for 3rd level children when you're on a 2nd level page.. kinda frustrating lol."

Not sure if I'm understanding correctly. Calling Children is context-sensitive and should only grab 3rd level children if they exist. Some code that should always show all submenus...

<% control Menu(1) %>
add level one menu stuff here
<% control Children %>
add level two menu stuff here
<% control Children %>
add level three menu stuff here
<% end_control %>
<% end_control %>
<% end_control %>

Another example - always shows parents, only shows children of the page you are on...

<% if Menu(1) %>
   <ul class="firstLevel">
      <% control Menu(1) %>
            <li><a href="$Link" title="$MenuTitle" class="$LinkingMode">$MenuTitle</a>
   
               <% if LinkOrSection = section %>
                  <ul class="secondLevel">            
                     <% control Children %>
                        <li class="$LinkingMode <% if FirstLast %>$FirstLast<% end_if %>">
                           <a href="$Link" title="$MenuTitle" class="$LinkingMode">$MenuTitle</a>
                           <% if LinkOrSection = section %>
                                 <ul class="thirdLevel">
                                    <% control Children %>
                                       <li class="$LinkingMode <% if FirstLast %> $FirstLast<% end_if %>">
                                          <a href="$Link" title="$MenuTitle" class="$LinkingMode">$MenuTitle</a>
                                       </li>
                                    <% end_control %>
                                 </ul>
   
                           <% end_if %>
         
                        </li>
                     <% end_control %>
                  </ul>
               <% end_if %>
   
            </li>
      <% end_control %>
   </ul>
<% end_if %>

Avatar
contigo

Community Member, 16 Posts

10 April 2008 at 10:56am

Edited: 10/04/2008 10:59am

The 2nd example doesn't need <% if children %> because that's part of what <% control Children %> does. Well, at least that's my understanding of it all. Let me know if I'm not understanding/helping :)

-Billy

Avatar
dancrew32

Community Member, 15 Posts

11 April 2008 at 7:59am

you rock, kind sir. that 2nd one is the ticket. thanks so very much