17452 Posts in 4473 Topics by 1971 members
|Go to End|
29 August 2008 at 10:52pm
Well - my first SilverStripe post.
I have a query regarding dynamic navigation. Obviously each menu item is added as a page is published.
On the site I'm planning, I have a horizontal nav menu and vertical. How do I dictate which page appears on which menu?
30 August 2008 at 2:08am
Is this something like the horizontal nav is for the main, top level links, and the vert nav is for the sub pages?
If so, check out the blackcandy theme that comes included. It is setup like this already. Dig through the templates to see how its down.
Or you mean you have 2 navs for different pages and they never show up at the same time? You'd have to setup different page types for each by extending the Page class and associate the template with just the code. Or run a bunch of <% if inSection(page) %> checks in your template to see which page you're on and display the correct nav.
30 August 2008 at 2:20am
This probably better explains the idea of what I want to achieve:
The horizontal menu is level 1 and then there are items on the vertical menu that are also level 1.
30 August 2008 at 4:06am
That is pretty much like the menu in blackcandy except the vert shows level ones as well. That could easily be changed by editing the menu code and which levels are displayed. If you look at SideBar.ss you'll see the code is to just display Menu(2), so what you'd want to do is include Menu(1) wrapped around it following the same concept as the nested ones. <% if Children %> etc.
Maybe I'm still missing something. Are the level 1s in the horizontal the same as the level 1s in the vertical or are you trying to leave some out?
30 August 2008 at 5:07am Last edited: 30 August 2008 5:08am
This might help you.
(from coffeeNcream theme)
<% control Menu(1) %>
<a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a>
<% control Children %>
<li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>
<% end_control %>
<% end_control %>
30 August 2008 at 6:22am
I want to define what level 1's (and how many) to show in the horizontal and the rest in the vertical.
In the Coffee theme the vertical menu just repeats the horizontal.
1 September 2008 at 11:57am
There isn't really a great way to do that. An option might be to uncheck the 'show in menu' option in the behavior tab, then in your template use <% control AllChildren %> to show them all in the nav you want all of them.
14 November 2008 at 8:32am
You can create a menu that is separate from, and independent of, the main menu. I use this technique to create a secondary menu that I use for a footer:
|Go to Top|