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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Simple question about the top menu navigation


Go to End


4 Posts   2056 Views

Avatar
boosis

Community Member, 8 Posts

17 May 2011 at 8:27pm

Edited: 17/05/2011 8:28pm

Hi,
My SS consists of 4 main pages - People, Corporate, Projects, Knowledge. All other pages are under one of these. My top navigation code is

<div id="topMenu">
<ul class="clearfix">
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>
<% end_control %>
</ul>
</div>

and an arrow appears under the menu title once it's selected.

Now, everything works fine, but if go deep in the tree, I loose the arrow in the main navigation.

Let's say. I am on people page. The arrow is under "People" menu item. But if I navigate to "People" -> "Our People" arrow disappears. I want to show that error for all children of People (or any other main menu item) page.

Hope this makes sense.

Thanks.

Avatar
boosis

Community Member, 8 Posts

17 May 2011 at 8:28pm

Css for the arrow is

#topMenu ul li a.current
{
color: #48AA43;
text-decoration: none;
background: url('../images/selected_arrow.jpg') bottom center no-repeat;
}

Avatar
boosis

Community Member, 8 Posts

17 May 2011 at 10:30pm

Sorted by assigning same css to .section tag.

Avatar
Willr

Forum Moderator, 5523 Posts

21 May 2011 at 5:38pm

Or you could have used $LinkOrSection which returns link for plain, section for current or child. Useful tricks - http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls#linkingmode-linkorcurrent-and-linkorsection