Forum: Ruby on Rails nesting layouts?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
78427ee90a59964d712126507c6bf4a0?d=identicon&s=25 Harm Aa (harm)
on 2006-04-17 20:58
Hi all,
Currently I am working on a site which in principle consists of three
div's, a menu, a left div and a right div. Now the content of the left
and right div can vary wildly but the overall 'feeling' should be the
same.
Now I have one template, called 'index.rhtml' which checks in a long
list of if-then-else what to render. This is of course really really
ugly. I would rather have some this like @content_for_layout but now
@content_for_left_div and @content_for_right_div. Is this possible?
Moreover, if it's not, do partials have the same access to global
variables as the parent template? That would also help a lot in cleaning
up.
Thanks in advance.

Harm
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-04-17 21:06
(Received via mailing list)
Another consideration would be to put your navbar in a application
helper.  That works very well also.
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-04-21 05:46
(Received via mailing list)
Look at content_for()

http://api.rubyonrails.org/classes/ActionView/Helpers/
CaptureHelper.html#M000528

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
This topic is locked and can not be replied to.