Jump to:

3445 Posts in 1031 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » Newbie Question Re Menu1~Current

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

Page: 1
Go to End
Author Topic: 754 Views
  • jwurmz
    Avatar
    Community Member
    2 Posts

    Newbie Question Re Menu1~Current Link to this post

    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
  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Newbie Question Re Menu1~Current Link to this post

    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 }

  • jwurmz
    Avatar
    Community Member
    2 Posts

    Re: Newbie Question Re Menu1~Current Link to this post

    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

    754 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.