I don't know what the most elegant way is, but you can render
variables and stuff inside of
a layout just like in any other view and call 'render :partial' from
within the layout as well.

You can also do this, inside of the application_controller define:

def self.get_layout
 'mylayout'
end

Then in your controllers use this:

layout get_layout

then you can redefine whatever layout you want more dynamically

On Jul 15, 8:36 am, Patrick Doyle <wpds...@gmail.com> wrote:
> There, was that subject sufficiently obtuse to grab your attention? :-)
>
> I would like to have several different stylesheets for my application
> that may be selected dynamically as the user navigates through my
> site.  I have seen this done in PHP by passing parameters to each page
> visited selecting (in that particular example) a stylesheet with a
> larger or smaller font size, or high contrast vs normal contrast
> viewing.  In the PHP example, the author appended
> ?fontsize=larger&contrast=high parameter to each link he generated.
> Then, on each page, he looked at those parameters and selected the
> appropriate stylesheet.
>
> What is the most elegant way to do a similar thing in RoR?  Obviously,
> the "on each page" part goes into the application layout.
>
> I could follow his lead and simply add the parameters to every link I
> generate in my views, but I wonder if there is a way to set a
> parameter globally that would automatically get tacked onto any URL's
> generated by link_to and friends.
>
> Alternatively, I could store the data used to select the stylesheet in
> the session.
>
> Alternatively, I could ask the community what other folks have done
> and learn from them.
>
> --wpd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to