3 different areas, 1 yield?!

Hello,

I’m having a problem which is following:

[STUFF FROM THE DB]
[STUFF FROM THE DB]
<%= yield %>
[STUFF FROM THE DB]

How can I fill the [STUFF FROM THE DB] div’s when I only have one single
yield? I can’t think of any possible solution…

I’m not sure but guessing these things may change on a per-template
basis. If so content_for may be what you’re looking for:

You could also use a partial to pull this off.

– Josh
http://iammrjoshua.com

Heinz S. wrote:

Hello,

I’m having a problem which is following:

[STUFF FROM THE DB]
[STUFF FROM THE DB]
<%= yield %>
[STUFF FROM THE DB]

How can I fill the [STUFF FROM THE DB] div’s when I only have one single
yield? I can’t think of any possible solution…

Yep! Thanks a lot.

One more question arose that Google and the search couldn’t answer:
One of these div’s have the very same entry no matter what page is being
loaded therefore I’d need have:

<% content_for :footer do %>
<%= render :partial => “shared/footer” %>
<% end %>

in every view and this is not very DRY. Is there any possibility to make
it DRY?

That should go into your layout (apps/views/layouts).

Heinz,

You should really take a look at this:

http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/

Cheers, Sazima

On Oct 22, 1:35 pm, Heinz S. [email protected]