# How to use frame in RoR

**URL:** <https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811>\
**Category:** Rails\
**Created:** [September 17, 2008, 9:27am UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811 "2008-09-17T09:27:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [September 17, 2008, 9:27am UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811/1 "2008-09-17T09:27:24Z")

</div>

hello i want to use frame in RoR …  
how to create frame in RoR?

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [September 17, 2008, 1:33pm UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811/2 "2008-09-17T13:33:59Z")

</div>

Hi,  
The normal way is to define the general structure of your page in the  
layout (layouts/application.html.erb). For simple sites, you just use  
one layout for all your views, so if you use script/generate to make  
your controllers, remove the automatically generated layouts for each  
controller.

Your layout would contain the various pieces of the page:

 some common content here. logo, title, etc... use variables like \<%= pagetitle %\> that are set in your controller/actions 

 this is your left navigation menu \<%= render :partial =\> shared/menu %\> to render \_menu.html.erb %\> 

 This is the content for the view being called \<%= yield %\> 

 \<%= render :partial =\> shared/footer %\> 

If you have specific content that needs to be displayed in one of your  
‘frames’ depending on the main view, you can call this in your view:  
\<% content\_for :left\_nav %\>  
some specific content here  
\<% end %\>  
and you should call \<%= yield :left\_nav %\> in your layout.

Finally in your css you define the positioning/styling of your various  
layout divs.

On 17 sep, 09:27, Dharmdip R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [September 17, 2008, 4:03pm UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811/3 "2008-09-17T16:03:44Z")

</div>

Dharmdip R. wrote:

> thanks ! i want specific content for each n every frame !  
> is it possible ? to get dynamic content for each n every content ?

Surely. content\_for just routes the output to the appropriate named  
div.

Individual views can use or ignore divs as they see fit, depending on  
what they are to render.

The app template is just that. If your template includes empty  
placeholders for all the different content snippets, you just use the  
suggested content\_for construct and send the rendered data to the  
appropriate div.

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [September 17, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811/4 "2008-09-17T13:36:50Z")

</div>

thanks ! i want specific content for each n every frame !  
is it possible ? to get dynamic content for each n every content ?

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [September 17, 2008, 4:13pm UTC](https://www.ruby-forum.com/t/how-to-use-frame-in-ror/148811/5 "2008-09-17T16:13:08Z")

</div>

Ar Chron wrote:

> Dharmdip R. wrote:
> 
> > thanks ! i want specific content for each n every frame !  
> > is it possible ? to get dynamic content for each n every content ?
> 
> Surely. content\_for just routes the output to the appropriate named  
> div.
> 
> Individual views can use or ignore divs as they see fit, depending on  
> what they are to render.
> 
> The app template is just that. If your template includes empty  
> placeholders for all the different content snippets, you just use the  
> suggested content\_for construct and send the rendered data to the  
> appropriate div.

thx ! chron
