Hmm, when you say you tried setting @page_title at the top of each
controller, what do you mean? Instance variables must be set on a
per-object basis, not a per-controller basis.
If I understand correctly what you''re trying to do, use a
before_filter call instead:
class HelloController < ActionController::Base
before_filter :set_title
# action methods etc.
def set_title
@page_title = "Hello!"
end
end
Duane Johnson
(canadaduane)
On Sep 28, 2005, at 9:27 AM, Chris Hall wrote:
> I have an app where several controllers share the same layout but i
> want each to have a different page title. I want to set this page
> title in one place and display it in the layout. The layout includes a
> couple of sub template renders as well.
>
> I tried setting @page_title at the top of each controller, but I''m
not
> getting any output (no errors either).
>
> Is there a place I can set this and have it accessible in the layout?
> I don''t want to have to set it in all the views because this
defeats
> the purpose of setting it in once place.
>
> Any help would be appreciated.
>
> Chris
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>