Hey, I am wondering how I might be able to adjust the code below to add an id to the links so that I can display that I am on a certain page in the nav.
Maybe similar to link_to_unless_currentCode:<ul id="nav"> <li><%= link_to "Blog", :action => "section", :id => 1 %></li> <li><%= link_to "About", :action => "section", :id => 2 %></li> <li><%= link_to "Contact", :action => "section", :id => 3 %></li> </ul>
but the resulting links might look like this if you are in the about sectionCode:<ul id="nav"> <li><%= link_to_unless_current "Blog", :action => "section", :id => 1 %></li> <li><%= link_to_unless_current "About", :action => "section", :id => 2 %></li> <li><%= link_to_unless_current "Contact", :action => "section", :id => 3 %></li> </ul>
Thanks in advance. I don't know what i would do without sitepoint forum.Code:<ul id="nav"> <li><a href="section/1">Blog</a></li> <li><a href="section/2" id="current">About</a></li> <li><a href="section/3">Contact</a></li> </ul>




Bookmarks