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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How to get current parent page from sublevel 2 ?


Reply


7 Posts   2369 Views

Avatar
jQuery.in.th

Community Member, 7 Posts

21 August 2009 at 5:42pm

I have page 2 level

Example :

Home Level1
|
- Subcontent Level 2
- Subcontent Level 2

I want "Home Level 1" active link after I clicked "Subcontent Level 2"...
Now it active just menu "Subcontent Level 2".

Please help me. :)

Avatar
banal

Community Member, 901 Posts

21 August 2009 at 7:12pm

You can style your menus using the classes provided by the $LinkingMode template control ([url=http://doc.silverstripe.com/doku.php?id=built-in-page-controls#links_and_classes]read the docs[/url]).

If you're using a theme, chances are high that the menu already uses the $LinkingMode class. All that is left to do in that case is to add the appropriate styles for .section

Avatar
jQuery.in.th

Community Member, 7 Posts

21 August 2009 at 7:55pm

Edited: 21/08/2009 8:03pm

Thank you for reply. :)

Please see images below.

Avatar
jQuery.in.th

Community Member, 7 Posts

21 August 2009 at 8:04pm

Edited: 21/08/2009 8:07pm

[url=http://www.uppic.net/show/cd89f31b2e56e882f57ac5c36925a20a][/url]

Avatar
banal

Community Member, 901 Posts

21 August 2009 at 9:29pm

Yes, I understood that from your first post and I provided you with the solution as well.
When you're in "sub menu", the Overview menu-item most likely gets the section css class. All that is left to do for you is add the proper styles for .section in your css file.

Avatar
jQuery.in.th

Community Member, 7 Posts

21 August 2009 at 9:30pm

:) Oh Cool it very easy. Thank you for your guide.

<div style="width:120px">
<ul>
<% control Menu(2) %>
<li id="menu">
<a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>"><span>$MenuTitle.XML</span></a>
</li>
<% end_control %>
</ul>
</div>

Avatar
jQuery.in.th

Community Member, 7 Posts

21 August 2009 at 9:32pm

Thank you Mr. banal very very so much.
I am new programming for SilverStripe :)

I love SilverStripe.