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' ) %>
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.
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.
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
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.
> 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?