SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2007
    0 Post(s)
    0 Thread(s)

    Displaying Active Link in CSS generated menu...that is located in the layout

    I am using a layout in a Ruby project. Basically it just displays the header with logo, navigation, and then yields for the content. After the content is displayed, the layout takes care of displaying the footer.

    What I would like to somehow display which link is active in the CSS menu...which again, is located in the layout.

    Is this possible? Would it be better to just move the navigation code into each view? I could get that to work of course...but I would have to change code in all the views should my categories/nav bar change.

    I think I worded that in a way that makes sense?

  2. #2
    SitePoint Evangelist
    Join Date
    Feb 2006
    Worcs. UK
    0 Post(s)
    0 Thread(s)
    You can have dynamic content in your layout as well as within your view. So you can create a navigation bar in the layout and then dynamically control its content.

    Have a look at link_to_unless_current:

    That gives you a way of easily managing links and changing their content if you are view the page the link refers to.

    You could also have a look at this posting about creating navigation links:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts