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 -- Posted via http://www.ruby-forum.com/.
Another consideration would be to put your navbar in a application helper. That works very well also. On Mon, 2006-04-17 at 20:58 +0200, Harm aa wrote:> 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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060417/82d40d5c/attachment.html
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 On Apr 17, 2006, at 2:58 PM, Harm aa wrote:> 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 > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails