you can also put something in your /config/routes.rb to add another variable
like :page
for example if your tabs all prefix with ''/nav'' or something
you can do this
map.connect ''/nav/:page'', :controller =>
"content", :action => "index"
then in the view you can do something like this inside your href to make it
active
<a href="/nav/tabname/" <%=
"id=''current''" if params[:page] ==
''tabname''
%>>Tabname</a>
adam
On 5/15/06, Jason Pfeifer <jpfeifer@shaw.ca>
wrote:>
> I think this is a fairly easy question done several times in several
> languages, but on a traditional ''tab'' based navigation
webpage, what''s
> the best way to handle the active state?
>
> I am using this in my view:
>
> <% for category in @categories %>
> <% if the condition is met to make this the active tab %>
> <li><a id=''active''
href=''#''><%= category.name %></a></li>
> <% else %>
> <li><a href=''#''><%= category.name
%></a></li>
> <% end %>
> <% end %>
>
> @categories are all user defined in the database. Is the best way to
> handle this by setting up a session variable that tracks it?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060516/5ac0c230/attachment.html