[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Template question (easy

justingoodman

10/20/2006 7:33:00 PM

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

4 Answers

curtis.schofield@gmail.com

10/20/2006 7:47:00 PM

0

Would

<%= puts IO.read('file') %>


work?


> 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
>
>


curtis.schofield@gmail.com

10/20/2006 7:47:00 PM

0

Wait..

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


> 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
>
>


justingoodman

10/20/2006 7:51:00 PM

0

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?

Payton Swick

10/20/2006 8:13:00 PM

0

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

On 10/20/06, justingoodman@gmail.com <justingoodman@gmail.com> wrote:
> 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
>
>
>