Multiple @content_for_layout in template?

Hi guys,

I’m having a few experiments making sites with Rails and I’ve come
across a problem. I’ve made a template for the parts of the site that
the public will see and it has two main columns in it, a main content
column and a thin side column. The content in each of these will change
on each page of the site but I’m not exactly sure about how to send
different data to each column.

At the moment the main column is being filled with data from a view file
using <%= @content_for_layout %>. How would I go about getting another
set of data from another view file into the other column?

Thanks
Henry

Can anyone help out here? Please!

On Jul 31, 2006, at 2:39 PM, Henry B. wrote:
[previous post:

Hi guys,

I’m having a few experiments making sites with Rails and I’ve come
across a problem. I’ve made a template for the parts of the site that
the public will see and it has two main columns in it, a main content
column and a thin side column. The content in each of these will change
on each page of the site but I’m not exactly sure about how to send
different data to each column.

At the moment the main column is being filled with data from a view file
using <%= @content_for_layout %>. How would I go about getting another
set of data from another view file into the other column?

Thanks
Henry

]

Can anyone help out here? Please!

You can use instance variables in a layout as well, just set it in
the controller (@title for example) then reference it.

You may also want to check out the content_for function (http://
api.rubyonrails.org/classes/ActionView/Helpers/
CaptureHelper.html#M000528)

Finally, all of this is deprecated. Use ‘yield’ or ‘yield :name’ in
place of ‘@content_for_layout’ and ‘content_for’, respectively.

Here are some details: http://weblog.rubyonrails.org/2006/4/25/use-
params-not-params

-Mat

Legendary. Thanks very much! :smiley: