17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 5101 Views |
-
Multi-level Menu Help

28 June 2008 at 12:15pm
Hi. I'm having an issue making a multi-level menu. I have this setup in my admin-view-tree.
However, I can only get two levels to show up on the actual page's sidebar. I attempted to do some code hacking on the .ss page, but couldn't quite get it. Could someone give me some guidance?
-
Re: Multi-level Menu Help

28 June 2008 at 7:24pm
Are you using the blackcandy theme? I think it should support at least 4 levels - first level in the tabs, then 3 levels on that sidebar... So try have a look at that Sidebar.ss file
So you would have this sort of structure for 3 levels in the same nav
<% control Menu(1) %>
// outputs top level - Product Support
<% control Children %>
// outputs BCC Support, BCC worksheet etc
<% control Children %>
// Outputs 3rd level - Codename Topaz..
<% end_control %>
<% end_control %>
<% end_control %> -
Re: Multi-level Menu Help

29 June 2008 at 12:51pm
I am using the "Pluralism" theme. So a setup like the one you posted should work? And if so, is there some specific order (inside/outside/etc.) I need to put the <ul> and </ul> tags in to create a indented list?
-
Re: Multi-level Menu Help

29 June 2008 at 1:04pm
if you want to indent the list then you should nestle the ul so like http://pastie.org/224229
-
Re: Multi-level Menu Help

30 June 2008 at 4:37am Last edited: 30 June 2008 4:37am
I applied the code in the pastie and it did make a change, however now instead of dynamically showing the levels, it always shows every page on the site, and there are no indentations:
I'm sorry that I have to ask for all the help, but this is really my first time actually using SilverStripe for a project.
-
Re: Multi-level Menu Help

30 June 2008 at 9:12am
You have to use CSS to control the indentations. HTML alone doesnt work. Try something like below. Im assuming the sidebar has a id of #Sidebar
#Sidebar ul ul {
margin-left: 10px;
} -
Re: Multi-level Menu Help

21 July 2008 at 11:18am
This is kind of a large bump, so apologies for that. I've fixed a few bugs, but am stuck with one. Instead of only showing the children of the current page/section, it shows every page and every subpage within it.
This is my current Sidebar.ss file:
<ul>
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul> -
Re: Multi-level Menu Help

21 July 2008 at 11:57am
if you only want to show the children on the selected page then you have to nestle the 2nd and 3rd control Children in a command to detect if they are in the Current Section by using LinkOrSection = section which will return true if you are on that page or a child of that page (eg in the same section of the tree
<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 %>
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a>
<% if LinkOrSection = section %>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" <% if LinkingMode %>class="$LinkingMode"<% end_if %>>$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>
| 5101 Views | ||
| Go to Top | Next > |




