Placing images at <div class="images" >

Hi All,

I am using blueprint framework for my UI design.

I have a set of static pages which I have displayed at the correct location using <%= yield >.

Now I want to place a image for each of those static pages at a different location. say

How can I achieve this in Rails 3.0.

Regards,
Bhasker.

I don't understand what it is that you do not know how to do. If you
want an image in a div with appropriate class just do
<div class="images"><%= image_tag('your_image.png') %></div>
or you could put the class on the image itself
<%= image_tag( 'your_image.png', :class => 'images' ) %>

Colin

Hi Collin,

I use application.html.erb to do my styling (span-1 to span-24) and divide it into various sections. Namely, logo, header1, then col1, Content area, col2 then footer.

Now assume, I have 10 pages (all static) which is from menu->submenu.

When I click on menu ->submenu -> item then I want the description to be displayed in the content area. Which I achieved by doing <%= yield %>. All fine.

Now I want image 1 to be in col1 and corresponding content in body when the appropriate selection is done. Like that for all 10 selections (which could come from submenus).

I am not able to get the correct image and the correspoding content displayed.

Hope I have explained it better.

Thanks & Warm Regards,

Hi Collin,
I use application.html.erb to do my styling (span-1 to span-24) and divide
it into various sections. Namely, logo, header1, then col1, Content area,
col2 then footer.
Now assume, I have 10 pages (all static) which is from menu->submenu.
When I click on menu ->submenu -> item then I want the description to be
displayed in the content area. Which I achieved by doing <%= yield %>. All
fine.
Now I want image 1 to be in col1 and corresponding content in body when the
appropriate selection is done. Like that for all 10 selections (which could
come from submenus).
I am not able to get the correct image and the correspoding content
displayed.

What html are you trying to generate?

Colin

I think what you need is content_for.

http://api.rubyonrails.org/classes/ActionView/Helpers/CaptureHelper.html#method-i-content_for

Hi,

I don’t understand your question.

Actually, I have some text in in text(1…10).html.erb and for each of these files I have image(1…10). Whenever I load text(1…10) in content area I want to load the image(1…10) in col1 area.

ie. if text1 is in content area then I want image1 in col1 area

if text10 is in content area then I want image10 in col1 area

Regards,

Hi,
I don't understand your question.
Actually, I have some text in in text(1...10).html.erb and for each of these
files I have image(1..10). Whenever I load text(1..10) in content area I
want to load the image(1..10) in col1 area.
ie. if text1 is in content area then I want image1 in col1 area
.............
..............
if text10 is in content area then I want image10 in col1 area

Please don't top post, it makes it difficult to follow the thread.
Insert your reply in the previous message at the appropriate points.
Thanks

I think Jim is probably right, content_for may be what you want, in
conjunction with multiple yield statements
yield :content
yield :col1
or something like that.

Colin

Hi,

I don’t understand your question.

Actually, I have some text in in text(1…10).html.erb and for each of these

files I have image(1…10). Whenever I load text(1…10) in content area I

want to load the image(1…10) in col1 area.

ie. if text1 is in content area then I want image1 in col1 area

   .............
  ..............
 if text10 is in content area then I want image10 in col1 area

Please don’t top post, it makes it difficult to follow the thread.

Insert your reply in the previous message at the appropriate points.

Thanks

Sorry for topping and thank you for your quick reply.

I have the following lines in my application.html.erb

I have to get the image1 here

<%= yield %>

Now, how do I use yield:content and yield:col1

Warm Regards,

> Hi,
> I don't understand your question.
> Actually, I have some text in in text(1...10).html.erb and for each of
> these
> files I have image(1..10). Whenever I load text(1..10) in content area
> I
> want to load the image(1..10) in col1 area.
> ie. if text1 is in content area then I want image1 in col1 area
> .............
> ..............
> if text10 is in content area then I want image10 in col1 area

Please don't top post, it makes it difficult to follow the thread.
Insert your reply in the previous message at the appropriate points.
Thanks

Sorry for topping and thank you for your quick reply.
I have the following lines in my application.html.erb
......
...
<col1>
I have to get the image1 here
</col1>
......
....
<content>
<%= yield %>
</content>
..........
........
Now, how do I use yield:content and yield:col1

Did you do a bit of googling and checking the docs?

     <col1>
          <%= yield :col1
     </col1>
......
....
     <content>
           <%= yield :content %>
     </content>

Then in the file you are yielding to

<% content_for :col1 do %>
  <%= image_tag .... or whatever %>
<% end %>

<% content_for :content do %>
  some other stuff
<% end %>

Colin

Jim & Collin,

The link was useful but could not get the yielding part till I saw Collin’s mail.

But, my tag name appears and not the image. Will it matter if I have a background image loaded.

Regards,

Hey Guys,

I got it.

BUT,

Though the image was in images directory, I did …/…/…/public/images/*.png it did not work.

Then I gave the absolute path. “/home/…/*.png” it did not work.

Then I just tried image.png " It worked perfectly"

Thank you for your help.