# Template question (easy)

**URL:** <https://www.ruby-forum.com/t/template-question-easy/73053>\
**Category:** Ruby\
**Created:** [October 20, 2006, 9:37pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053 "2006-10-20T21:37:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 20, 2006, 9:37pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053/1 "2006-10-20T21:37:18Z")

</div>

So I originally took up a project of making a simple blog for myself  
and some friends to use to communicate with family while at college.  
I’ve got most of it finished code wise, I am now in the process of  
formatting the pages so it is all identical.

I am wondering, in my views folder, I have several .rhtml template  
files, is there a way I can just define a single template file and a  
load point in the code, and have all my other template files load in  
that defined spot on the template file?

If not, is there another solution, or am I simply going to have to copy  
and paste my code into all of my template files so they all load the  
same page layout?

Thanks,

Justin

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 20, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053/2 "2006-10-20T21:47:19Z")

</div>

Would

\<%= puts IO.read(‘file’) %\>

work?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 20, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053/3 "2006-10-20T21:49:21Z")

</div>

Wait…

you said views folder. … If your using Rails try partials.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 20, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053/4 "2006-10-20T21:57:21Z")

</div>

I haven’t had much practice with partials yet. I assume from what I  
saw, a partial just grabs the little tiny segment of code I have, and  
puts it somewhere else. Not entirely sure how to implement that  
accurately though.

Any tips or starting places to figure out how to learn it?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 20, 2006, 10:13pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053/5 "2006-10-20T22:13:24Z")

</div>

It sounds like what you’re looking for is layouts.

app/views/layouts/\*.rhtml

I’m sure there’s plenty of information scattered around the web on  
using layouts, but you could also check a rails book, like Agile Web  
Development with Rails.

Hope that’s helpful.

-Payton
