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

LinkingMode help needed......


Go to End
Reply

10 Posts   4755 Views

Avatar
Adamski

14 October 2008 at 2:10am Community Member, 14 Posts

Hello everyone....!

I have a vertical menu with indented children and the code below works well for me. The only thing I cannot get to work is the Linking Mode to work. I basically want the active page to be highlighted regardless of whether it is level 1, 2 or 3 of the nav.

Can anyone help me out? I'll buy you a chocolate bar!

Thanks
/Adam

<ul>
         <% control Menu(1) %>
            <li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"><% end_if %>$MenuTitle</a>
            <% if LinkOrSection = section %>      
            <% if Children %>
            <div id="leftbox_sub">
               <ul>
               <% control Children %>
               <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
                        <% if LinkOrSection = section %>      
                        <% if Children %>
                        <div id="leftbox_sub2">
                        <ul>
                        <% control Children %>
                        <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
                                    <% if LinkOrSection = section %>      
                                    <% if Children %>
                                    <div id="leftbox_sub3">
                                    <ul>
                                    <% control Children %>
                                    <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
                                    <% end_control %>
                                    </ul>
                                    </div>
                                    <% end_if %>
                                    <% end_if %>
         
                        </li>
                        <% end_control %>
                        </ul>
                        </div>
                        <% end_if %>
                        <% end_if %>
               </li>
               <% end_control %>
               </ul>
            </div>
            <% end_if %>
            <% end_if %>
            </li>
         <% end_control %>
      </ul>

Avatar
Willr

14 October 2008 at 10:03am Forum Moderator, 5511 Posts

ctive page to be highlighted regardless of whether it is level 1, 2 or 3 of the nav.

Then you would use class="$LinkOrSection" which will return 'link' if its not on this page or a child. Or 'section' if its on this page or a child

Avatar
Adamski

14 October 2008 at 10:10am Community Member, 14 Posts

and do I apply that class to the <ul> or <li>?

Avatar
banal

14 October 2008 at 10:42am Community Member, 901 Posts

You should apply the class to the <li> or the <a> tag. Of course you'll still need a appropriate css stylesheet.

Avatar
Adamski

14 October 2008 at 10:48am Community Member, 14 Posts

so my code should look like this..... (see below)

and then I create classes for 'link' and 'section'?

(sorry to be so slow!)

>
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
<% if LinkOrSection = section %>
<% if Children %>
<div id="leftbox_sub">
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
<% if LinkOrSection = section %>
<% if Children %>
<div id="leftbox_sub2">
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
<% if LinkOrSection = section %>
<% if Children %>
<div id="leftbox_sub3">
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a></li>
<% end_control %>
</ul>
</div>
<% end_if %>
<% end_if %>

</li>
<% end_control %>
</ul>
</div>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>
</div>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>

Avatar
Adamski

14 October 2008 at 10:02pm Community Member, 14 Posts

hmmm..... this didn't work. Where are I going wrong?

Avatar
Adamski

16 October 2008 at 12:43am Community Member, 14 Posts

anyone?

Avatar
Adamski

16 October 2008 at 3:03am Community Member, 14 Posts

I've attached a screenshot of the effect I want to achieve.

Level 1 - Black
Level 2 - Blue
Level 3 - Red
Level 4 - Green

In this screenshot the page 'Bronze Award' is the active page and therefore the link I want to show in it's active state.

Hope someone out there can help me....! Here is my code as it stands

<ul>
      <% control Menu(1) %>
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
      <% if LinkOrSection = section %>
      <% if Children %>
      <div id="leftbox_sub">
      <ul>
      <% control Children %>
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
      <% if LinkOrSection = section %>
      <% if Children %>
      <div id="leftbox_sub2">
      <ul>
      <% control Children %>
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
      <% if LinkOrSection = section %>
      <% if Children %>
      <div id="leftbox_sub3">
      <ul>
      <% control Children %>
      <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkOrSection">$MenuTitle</a>
      </li>
      <% end_control %>
      </ul>
      </div>
      <% end_if %>
      <% end_if %>
      </li>
      <% end_control %>
      </ul>
      </div>
      <% end_if %>
      <% end_if %>
      </li>
      <% end_control %>
      </ul>
      </div>
      <% end_if %>
      <% end_if %>
      </li>
      <% end_control %>
</ul>

Go to Top