Makes sense. Very cool! Thanks Yehuda
On Nov 23, 8:46 pm, "Yehuda Katz" <[EMAIL PROTECTED]> wrote: > And I forgot to say that you build your subtemplate exactly the same as you > would build a regular template, using catch_content(:for_layout). > -- Yehuda > > > > > > On Sun, Nov 23, 2008 at 8:44 PM, Yehuda Katz <[EMAIL PROTECTED]> wrote: > > The easiest way I've found to do nested layouts is: > > render(render(:layout => :sublayout)) > > > in effect, render(:layout => :sublayout) will do the render against the > > sublayout, and the outer layout will embed that into the default layout. You > > could also do: > > > render(render(:layout => :sublayout), :layout => :another_layout) > > > which would embed the rendering with "sublayout" inside "another_layout". > > > The reason this works is that render(:layout => :sublayout) returns a > > string, and render() takes a string, and embeds it into the default layout > > (or another layout if specified). > > > Does that make sense? > > > On Sun, Nov 23, 2008 at 7:09 PM, Jacques Crocker <[EMAIL PROTECTED]>wrote: > > >> Hi. I'm trying to DRY up my merb layouts. I have a overall app layout, > >> and then a few different inner templates that add some additional > >> markup wrapping. The ideal scenario for me would be to have something > >> like nested layouts. > > >> Searching google I found this: > >>http://blog.new-bamboo.co.uk/2008/3/15/nested-layouts-in-merb > > >> Unfortunately I dont think it works in Merb 1.0. When I try the exact > >> code in this technique, I get a hard merb crash. I believe its causing > >> an infinite loop. Heh, not only does it crash, but when I do ctrl-C to > >> stop the server it doesnt close it down. I have to kill the processes > >> manually. > > >> Can someone take a quick look and see what they are doing wrong? Or is > >> there an easier way now in Merb to use nested layouts? > > >> I'll go ahead and update the wiki with this once we're able to figure > >> this out. Nested layouts without crazy hacks (like the ones needed in > >> the rails nested layouts plugin) would be an awesome merb selling > >> point. > > >> Thanks > > > -- > > Yehuda Katz > > Developer | Engine Yard > > (ph) 718.877.1325 > > -- > Yehuda Katz > Developer | Engine Yard > (ph) 718.877.1325 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
