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.

Template Questions

menu tree trouble


Reply

6 Posts   1437 Views

Avatar
supermegaultra

10 November 2009 at 3:25pm Community Member, 33 Posts

Hi all,

I'm trying to create a menu tree that displays the links to the children pages directly under the parent link. For example if I clicked on 'tractors/machinery':

Home.

Parts/Accessories.

Tractors/Machinery.
- New Machinery
- Used Machinery

Workshop.

Contact.

Here is the code in my .ss file I have at the moment:

<ul id="Menu1">
<% control Menu(1) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
<% end_control %>
</ul>
         
      <% if Menu(2) %>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>

Any help?! Cheers.

Avatar
Willr

10 November 2009 at 5:23pm Forum Moderator, 5511 Posts

Try replacing the <% if Menu(2) %> with <% if LinkOrSection %>. The menu you are trying to achieve is similar to the default theme isn't it? You can use that as a good starting point.

Avatar
Willr

10 November 2009 at 5:24pm Forum Moderator, 5511 Posts

Try replacing the <% if Menu(2) %> with <% if LinkOrSection %>. The menu you are trying to achieve is similar to the default theme isn't it? You can use that as a good starting point.

Avatar
supermegaultra

11 November 2009 at 9:21am Community Member, 33 Posts

Cheers Willr,

Yeah I've just been using the menu from the default theme and have edited the CSS so it's styled like a virticle tree style menu. I just tried chaning <% if Menu(2) %> with <% if LinkOrSection %>, still looks the same damnit. Any other advice?

Avatar
supermegaultra

16 November 2009 at 10:33am Community Member, 33 Posts

Hi again, I'm still having trouble with this. Any help please?

Avatar
supermegaultra

17 November 2009 at 3:26pm Community Member, 33 Posts

ahhh ha, I've figured out a bit of the problem. My code in my Page.ss is as follows:

<ul id="Menu1">
<% control Menu(1) %>
<li class="$LinkingMode">
    <a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a>
    </li>
   
          
      <% if LinkOrSection = section %>
<ul id="Menu2">
          <% control GroupsMenu %>
          <% if Children %>
              <li class="$LinkingMode">
               <a href="$Link" title="<% sprintf(_t("GOTOPAGE","Go to the %s page"),$Title.XML) %>" class="$LinkingMode Nobottom">$MenuTitle</a>
           <% else %>
                <li><a href="$Link" title="<% sprintf(_t("GOTOPAGE"),$Title.XML) %>" class="$LinkingMode">$MenuTitle</a>
            <% end_if %>   
          
             <% if LinkOrSection = section %>
                <% if ChildGroups %>
                  <ul class="sub">
                     <li>
                         <ul>
                            <% control ChildGroups %>
                                <li class="$LinkingMode">
                                   <a href="$Link" title="<% sprintf(_t("GOTOPAGE"),$Title.XML) %>" class="$LinkingMode">$MenuTitle.LimitCharacters(22)</a>
                              </li>
                            <% end_control %>
                          </ul>
                       </li>
                   </ul>
                 <% end_if %>
            <% end_if %>
         </li>
         <% end_control %>
      </ul>
<% end_if %>
      
<% end_control %>
</ul>

My only issue is that it now formats like what is found on the left of this page [url]http://www.designalt.co.nz/jml/tractors-machinery/[/url]

How can I make the 'new tractors, used tractors, etc etc..' use the Menu2 CSS formatting?