# Templates in rails

**URL:** <https://www.ruby-forum.com/t/templates-in-rails/118156>\
**Category:** Rails\
**Created:** [October 24, 2007, 11:18am UTC](https://www.ruby-forum.com/t/templates-in-rails/118156 "2007-10-24T11:18:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 11:18am UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/1 "2007-10-24T11:18:32Z")

</div>

Hi,

I need to create the templates for ROR project , i dont know how  
to create the tempaltes in rails.

can any one help me my giving the clear picture of how to write the  
templates with examples

Thanks& regards  
meer

---

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 11:26am UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/2 "2007-10-24T11:26:39Z")

</div>

On Oct 24, 2550 BE, at 13:18, Kalimulla Meer wrote:

> can any one help me my giving the clear picture of how to write  
> the  
> templates with examples

Hi!  
I recommend that you read some basic book about Rails, e.g. Agile  
Development With Rails 2nd ed. from Pragmatic Programmers or Build  
Your Own Ruby on Rails Applications that is right now available for  
free from SitePoint.  
Alternatively, you can run script/generate scaffold YourModelName and  
look into your app/views folder for a hint about what Rails templates  
are.

---

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 11:44am UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/3 "2007-10-24T11:44:05Z")

</div>

Kalimulla Meer wrote:

> Hi,
> 
> I need to create the templates for ROR project , i dont know how  
> to create the tempaltes in rails.
> 
> can any one help me my giving the clear picture of how to write the  
> templates with examples
> 
> Thanks& regards  
> meer

HI  
Templates are actually views. you can have write temoplates in many  
forms like rhtml,xml etc.

I hope you know how to generate a controller

then inside the controller write like following code  
def list

end  
then in views create a rhtml file with name “list” then add any  
html code or  
simply type anything inside that file. then when you run this you can  
see the text typed on page. You can have good templates as you advance  
and use good html code.  
Good Luck

---

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/4 "2007-10-24T13:40:46Z")

</div>

Hi abhi  
Thanks for u hints,  
i need to know one more thing i.e, presently i have to write custom  
layouts for ralis projects can u plz suggest me for the same and give  
me samples  
regards  
meer

Abhi M. wrote:

> Kalimulla Meer wrote:
> 
> > Hi,
> > 
> > I need to create the templates for ROR project , i dont know how  
> > to create the tempaltes in rails.
> > 
> > can any one help me my giving the clear picture of how to write the  
> > templates with examples
> > 
> > Thanks& regards  
> > meer
> 
> HI  
> Templates are actually views. you can have write temoplates in many  
> forms like rhtml,xml etc.
> 
> I hope you know how to generate a controller
> 
> then inside the controller write like following code  
> def list
> 
> end  
> then in views create a rhtml file with name “list” then add any  
> html code or  
> simply type anything inside that file. then when you run this you can  
> see the text typed on page. You can have good templates as you advance  
> and use good html code.  
> Good Luck

---

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 1:41pm UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/5 "2007-10-24T13:41:17Z")

</div>

Hi

Thanks for u hints,  
i need to know one more thing i.e, presently i have to write custom  
layouts for ralis projects can u plz suggest me for the same and give  
me samples  
regards  
meer

Damian T. wrote:

> On Oct 24, 2550 BE, at 13:18, Kalimulla Meer wrote:
> 
> > can any one help me my giving the clear picture of how to write  
> > the  
> > templates with examples
> 
> Hi!  
> I recommend that you read some basic book about Rails, e.g. Agile  
> Development With Rails 2nd ed. from Pragmatic Programmers or Build  
> Your Own Ruby on Rails Applications that is right now available for  
> free from SitePoint.  
> Alternatively, you can run script/generate scaffold YourModelName and  
> look into your app/views folder for a hint about what Rails templates  
> are.

---

<div class="post-metadata">

**Author:** ![meerkalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@meerkalim](https://www.ruby-forum.com/u/meerkalim)\
**Post date:** [October 24, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/templates-in-rails/118156/6 "2007-10-24T21:59:46Z")

</div>

If you’re asking how to combine layouts and templates, have a look at  
this article

[http://gregwillits.wordpress.com/2007/10/16/modular-page-layouts-in-](http://gregwillits.wordpress.com/2007/10/16/modular-page-layouts-in-)  
ruby-on-rails/

and recently I saw this screencast which is a nice short overview on  
lyaouts too

> **[\#7 All About Layouts - RailsCasts](http://railscasts.com/episodes/7-all-about-layouts)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

– gw
