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

Newbie Question Re Menu1~Current


Reply

3 Posts   758 Views

Avatar
jwurmz

17 November 2010 at 2:08pm (Last edited: 17 November 2010 2:17pm), Community Member, 2 Posts

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: www.catalytium.com. 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 Page.ss, 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
Avatar
Willr

17 November 2010 at 6:20pm Forum Moderator, 5511 Posts

See this page for documentation on how you can get a class of "current" on the current menu item. http://doc.silverstripe.org/built-in-page-controls#links_and_classes.

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

Avatar
jwurmz

18 November 2010 at 5:34am (Last edited: 18 November 2010 9:10am), Community Member, 2 Posts

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: www.catalytium.com]

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:

|===TD#1====||============================TD#2===============================|
[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:
|=============TD#1==============||===TD#2====||=============TD#3==============|
[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 :)