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 /

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

Newbie Question Re Menu1~Current

Go to End

3 Posts   919 Views


Community Member, 2 Posts

17 November 2010 at 2:08pm

Edited: 17/11/2010 2:17pm

First of all, I'd like to thank the SilverStripe devs and the community which helps to support such awesome, open-source software. This is my first endeavor using a canned CMS (any CMS, really), and so far I am very much appreciative of the work it has (and will) save me. Cheers!

Second, as a newb to SS (and freelance webdev), I already have a problem :) Go figure, right?

I'm attempting to start from 'scratch,' using the Tutorial template as the drawing board. So far, so good: The trouble I'm having is with highlighting the currently selected 'Menu1' page. As you can see, it highlights the hovered menu entry, but the currently selected menu (page) is not highlighted. I'm not exactly sure what it is I'm doing wrong. I suspect one css file is stepping on the toes of another; I managed to get Menu2 to work as expected.

I've (EDIT: tried) attaching a 7z archive which includes my live, layout.css, and typography.css files (EDIT: but I get an error from the server; I can PM the file, if needed, but I did manage to attach the css files). Can anyone point me in the right direction? Also, if this isn't the most appropriate section to post in, I apologize -- feel free to relocate ;)

Again, thank you in advance. Any help is very much appreciated!!!

Attached Files

Forum Moderator, 5514 Posts

17 November 2010 at 6:20pm

See this page for documentation on how you can get a class of "current" on the current menu item.

Once you have a class of current added then you can style it in your CSS file using #Menu1 li a.current { YOUR STYLES }


Community Member, 2 Posts

18 November 2010 at 5:34am

Edited: 18/11/2010 9:10am

Thank you Willr. It turns out I didn't reference the class in the Menu1 <li> tag, but I did in the Menu2. Silly oversight.

[EDIT: Never mind the request below, I figured out a lazy way to do it using If Even and If Odd:]

I'm wondering about one other thing, maybe you can steer me in the right direction. Right now my Menu1 layout is encapsulated in a 2column / 1 row table something like:

[Company Logo][Menu1.Page1][Menu1.Page2][Menu1.Page3][Menu1.Page4][Menu1.Page5][Menu1.Page6]

..and I would like to set up the Menu1 table and layout such that it renders something like:
[Menu1.Page1][Menu1.Page2][Menu1.Page3][Company Logo][Menu1.Page4][Menu1.Page5][Menu1.Page6]

I imagine it's as simple as a conditional in the page template to render only Menu1.Page1-3 in TD#1, then render TD#2, then render Menu1.Page4-6 in TD#3. Looking at the example code in the tutorials, I think I understand how to set up the structure of the conditional blocks but how would I reference the variable for which Menu1.Page# is currently being parsed? ...what about the variable for Menu1.TotalPages? I'll go RTFM for now, but any help is appreciated :)