Hi, does Rails support nested layouts? For example you could have an application level layout that contains the head tags and so on, a nested layout for the ''magazine section'' containing the navbar and a certain CSS, then the content nested into that. As you move between sections you keep the same ''top level'' layout file (the one with the head tags, meta, etc, but switch the ''internal'' layout. So far I''ve only heard of the possibility of ''one layout'', and some nested content. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can use partials to reuse chunks of html across different layouts. For example, in your layouts directory could be setup like this: /layouts/_meta.rhtml /layouts/_nav.rhtml /layouts/_footer.rhtml /layouts/layout1.rhtml /layouts/layout2.rhtml /layouts/layout3.rhtml In each of the three layout files, you''d include each of the partials in their appropriate location in the page. e.g. to include the meta info, you''d use <% render :partial => ''/layouts/meta'' %> To specify which layout you''re using in a given controller, just use layout ''layout2'' at the top of your controller. Hope this helps. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There is a plugin that adds support for nested layouts: http://nested-layouts.rubyforge.org/ Steve Dogers wrote:> Hi, does Rails support nested layouts? For example you could have an > application level layout that contains the head tags and so on, a nested > layout for the ''magazine section'' containing the navbar and a certain > CSS, then the content nested into that. > > As you move between sections you keep the same ''top level'' layout file > (the one with the head tags, meta, etc, but switch the ''internal'' > layout. > > So far I''ve only heard of the possibility of ''one layout'', and some > nested content. > > -- > Posted via http://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---