On 2/23/07, Patrick Crowley <[EMAIL PROTECTED]> wrote:
Can you guys think of a way to grab the page title from an inline <h1> and then map that to @title?
I'm not quite what you're asking for, but I have some title-related ideas that may help. I once made a handy set of helper methods to create a generic title based on the controller, action, and objects present. When your controllers and actions have nice logical, predictable names then you'd be surprised what you can generate algorithmically: http://p.caboo.se/42524 Anyway, that might spark your imagination a little bit. I have a vague notion to combine this approach with the presence of custom @title instance variables, but haven't needed to so far. T1m Bray would probably object to my use of capitalize, singularize and all that, but I note that even in your example you basically set @title = controller.action_name.capitalize. As to your original question... using the value in that h1 really depends on how that h1 is being created. If it's hard-coded then I'm not so sure how to extract it into an instance variable, unless you just hard code it like this: <h1><%= @title = "Page title" %></h1> -- Nick Zadrozny • http://missionsbridge.org/people/nick
_______________________________________________ Sdruby mailing list [email protected] http://lists.sdruby.com/mailman/listinfo/sdruby
