# Nees Rhtml Book

**URL:** <https://rubytalk.org/t/nees-rhtml-book/36263>\
**Category:** ruby-talk\
**Created:** [19 March 2007 12:19 UTC](https://rubytalk.org/t/nees-rhtml-book/36263 "2007-03-19T12:19:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saravanankumar\_Sarav](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Saravanankumar\_Sarav](https://rubytalk.org/u/Saravanankumar_Sarav)\
**Post date:** [19 March 2007 12:19 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/1 "2007-03-19T12:19:50Z")

</div>

Hi,  
&nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or

&nbsp;&nbsp;Where I can get it?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ilan\_Berci](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@Ilan\_Berci](https://rubytalk.org/u/Ilan_Berci)\
**Post date:** [19 March 2007 14:01 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/2 "2007-03-19T14:01:00Z")

</div>

Saravanankumar Saravanan wrote:

> Hi,  
> &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or
> 
> &nbsp;&nbsp;Where I can get it?
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks

Saravanankumar,

There is no magic for rhtml as it's simply ruby embedded within html.  
Just pick up a good book on html and css to which there are thousands  
and you will be all set..

hope this helps

ilan

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [19 March 2007 19:49 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/3 "2007-03-19T19:49:12Z")

</div>

I am wondering, based on this and the previous post, whether you are  
actually using Ruby on Rails?

If so, you may be better placed asking questions on the Rails mailing list  
(you are currently on the Ruby language mailing list).

In any case, invest in a good book or two. I have found "Programming Ruby:  
The Pragmatic Programmer's Guide" and "Agile Web Development with Rails" to  
be invaluable. The latter has lots of rhtml and ajax examples.

Whilst these may be hard to find in India, the good news is that they are  
available to buy online in PDF form - and much cheaper than the paper  
versions.

> **[Pragmatic Bookshelf: By Developers, For Developers](https://pragprog.com/)**
>
> We improve the lives of professional developers. We create timely, practical books on classic and cutting-edge topics to help you learn and practice your craft, and accelerate your career. Come learn with us.

Also, an older version of Programming Ruby is available for free on-line:  
[http://www.rubycentral.com/book/](http://www.rubycentral.com/book/)

HTH,

Brian.

> **···**
>
> On Mon, Mar 19, 2007 at 09:19:50PM +0900, Saravanankumar Saravanan wrote:
> 
> > &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.

---

<div class="post-metadata">

**Author:** ![Corey](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Corey](https://rubytalk.org/u/Corey)\
**Post date:** [20 March 2007 00:37 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/4 "2007-03-20T00:37:31Z")

</div>

Saravanankumar Saravanan wrote:

> Hi,  
> &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or
> 
> &nbsp;&nbsp;Where I can get it?
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks

yeah rhtml is just html the r part of it is just there to tell rails  
that the name of the rhtml file is the name of an action.

I am just learning all this stuff to, i just started like 1 week ago  
learning both ruby and ruby on rails, the book i am using is called  
"Beginning Ruby on Rails" by Holzner Ph.d, its published by WROX, its  
pretty good so far.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Saravanankumar\_Sarav](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Saravanankumar\_Sarav](https://rubytalk.org/u/Saravanankumar_Sarav)\
**Post date:** [20 March 2007 03:43 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/5 "2007-03-20T03:43:45Z")

</div>

Ilan Berci wrote:

> Saravanankumar Saravanan wrote:
> 
> > Hi,  
> > &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or
> > 
> > &nbsp;&nbsp;Where I can get it?
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks
> 
> Saravanankumar,
> 
> There is no magic for rhtml as it's simply ruby embedded within html.  
> Just pick up a good book on html and css to which there are thousands  
> and you will be all set..
> 
> hope this helps
> 
> ilan

Yeah.  
&nbsp;&nbsp;I understood, about "ruby embedded html".

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thank U for ur reply.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![James\_Britt](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@James\_Britt](https://rubytalk.org/u/James_Britt)\
**Post date:** [20 March 2007 03:58 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/6 "2007-03-20T03:58:23Z")

</div>

I will give you one last hint before you realize you need to just learn the basic stuff or use a CMS:  
as stated,  
rhtml is just html with Puby code in it.  
users never see the ruby it's parsed by the server  
If you use Perl, Python, or PHP you can have phtml  
the secret is, you can actually name the file with any extension (almost) or no extension.  
the web browser (user-agent) doesn't care (isn't supposed to, anyway)  
the main information for the user-agent is in the header of the file.

so the only tutorial on rhtml is learning Ruby (or Rails) enough to use eRuby in one of its forms.  
ERb, eRuby, eRubis

> **···**
>
> On Mar 20, 2007, at 9:37 AM, Corey Konrad wrote:
> 
> > Saravanankumar Saravanan wrote:
> > 
> > > Hi,  
> > > &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or
> > > 
> > > &nbsp;&nbsp;Where I can get it?
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks
> > 
> > yeah rhtml is just html the r part of it is just there to tell rails  
> > that the name of the rhtml file is the name of an action.
> > 
> > I am just learning all this stuff to, i just started like 1 week ago  
> > learning both ruby and ruby on rails, the book i am using is called  
> > "Beginning Ruby on Rails" by Holzner Ph.d, its published by WROX, its  
> > pretty good so far.
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Rick\_DeNatale1](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rick\_DeNatale1](https://rubytalk.org/u/Rick_DeNatale1)\
**Post date:** [20 March 2007 16:38 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/7 "2007-03-20T16:38:29Z")

</div>

Not really, the rhtml tells rails (or more precisely ActionView) that  
the file needs to be processed by erb. It really doesn't tell it that  
it's the name of an action, although if rails doesn't find an action  
method in the controller, it will by default look for a file to render  
in app/views/controller\_name. This file can be an rhtml file or  
something else (like a simple html file).

Rhtml is html with embedded ruby. It does get processed on the server  
side by erb, or an equivalent program. What basically happens is that  
it get's turned into ruby code which writes out the html portions  
interspersed with the output from the embedded ruby code.

There's not much to it in normal usage. The key concepts are that  
ruby code gets embedded within \<% %\> pairs, If the first \<% is  
followed by an = sign, then the value of the ruby expression following  
is inserted into the output.

The client browser never sees the rhtml, only the (x)html which  
results from running erb.

> **···**
>
> On 3/19/07, Corey Konrad \<0011@hush.com\> wrote:
> 
> > yeah rhtml is just html the r part of it is just there to tell rails  
> > that the name of the rhtml file is the name of an action.
> 
> --  
> Rick DeNatale
> 
> My blog on Ruby  
> [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![Deepak\_Kumar\_Shivhar](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Deepak\_Kumar\_Shivhar](https://rubytalk.org/u/Deepak_Kumar_Shivhar)\
**Post date:** [20 March 2007 05:47 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/8 "2007-03-20T05:47:00Z")

</div>

Saravanankumar Saravanan wrote:

> Ilan Berci wrote:
> 
> > Saravanankumar Saravanan wrote:
> > 
> > > Hi,  
> > > &nbsp;&nbsp;Please, Any body have, rhtml tutorials/urls to study.
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or
> > > 
> > > &nbsp;&nbsp;Where I can get it?
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks
> > 
> > Saravanankumar,
> > 
> > There is no magic for rhtml as it's simply ruby embedded within html.  
> > Just pick up a good book on html and css to which there are thousands  
> > and you will be all set..
> > 
> > hope this helps
> > 
> > ilan
> 
> Yeah.  
> &nbsp;&nbsp;I understood, about "ruby embedded html".
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thank U for ur reply.

Hello,  
&nbsp;&nbsp;&nbsp;Definately there is no magic in RHTML.  
If you want to help in RHTML the check it out the following links. May  
it will help you.

1. [http://webddj.sys-con.com/read/223793.htm](http://webddj.sys-con.com/read/223793.htm)  
2. [http://www.railshosting.org/](http://www.railshosting.org/)  
3. [http://www.vtc.com/products/rubyonrails.htm](http://www.vtc.com/products/rubyonrails.htm)

Thanks 🙂  
Deepak

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![James\_Britt](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@James\_Britt](https://rubytalk.org/u/James_Britt)\
**Post date:** [20 March 2007 17:07 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/9 "2007-03-20T17:07:43Z")

</div>

You could use eRuby with any .extension  
In fact you could serve web pages with any or no dot extension.  
The key is that the server knows what to do with it.  
An example is Apache. You tell Apache what to do with files of various extensions. You could tell it to parse all .html files with Ruby, or all .php files with Perl.  
Thus, many rails pages show URL/URI with no dot extension at all in the web browser. It is important only if you use multiple language interpreters or your web application framework requires it.

> **···**
>
> On Mar 21, 2007, at 1:38 AM, Rick DeNatale wrote:
> 
> > On 3/19/07, Corey Konrad \<0011@hush.com\> wrote:
> > 
> > > yeah rhtml is just html the r part of it is just there to tell rails  
> > > that the name of the rhtml file is the name of an action.
> > 
> > Not really, the rhtml tells rails (or more precisely ActionView) that  
> > the file needs to be processed by erb. It really doesn't tell it that  
> > it's the name of an action, although if rails doesn't find an action  
> > method in the controller, it will by default look for a file to render  
> > in app/views/controller\_name. This file can be an rhtml file or  
> > something else (like a simple html file).
> > 
> > Rhtml is html with embedded ruby. It does get processed on the server  
> > side by erb, or an equivalent program. What basically happens is that  
> > it get's turned into ruby code which writes out the html portions  
> > interspersed with the output from the embedded ruby code.
> > 
> > There's not much to it in normal usage. The key concepts are that  
> > ruby code gets embedded within \<% %\> pairs, If the first \<% is  
> > followed by an = sign, then the value of the ruby expression following  
> > is inserted into the output.
> > 
> > The client browser never sees the rhtml, only the (x)html which  
> > results from running erb.
> > 
> > --  
> > Rick DeNatale
> > 
> > My blog on Ruby  
> > [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![Jeremy\_McAnally1](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jeremy\_McAnally1](https://rubytalk.org/u/Jeremy_McAnally1)\
**Post date:** [20 March 2007 17:44 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/10 "2007-03-20T17:44:32Z")

</div>

That's not entirely true; if you're using eRb with Rails, it requires  
that templates end in rhtml or erb. Otherwise, you could coceivably  
use it without an extension.

--Jeremy

> **···**
>
> On 3/20/07, John Joyce \<dangerwillrobinsondanger@gmail.com\> wrote:
> 
> > You could use eRuby with any .extension  
> > In fact you could serve web pages with any or no dot extension.  
> > The key is that the server knows what to do with it.  
> > An example is Apache. You tell Apache what to do with files of  
> > various extensions. You could tell it to parse all .html files with  
> > Ruby, or all .php files with Perl.  
> > Thus, many rails pages show URL/URI with no dot extension at all in  
> > the web browser. It is important only if you use multiple language  
> > interpreters or your web application framework requires it.
> > 
> > On Mar 21, 2007, at 1:38 AM, Rick DeNatale wrote:
> > 
> > \> On 3/19/07, Corey Konrad \<0011@hush.com\> wrote:  
> > \>  
> > \>\> yeah rhtml is just html the r part of it is just there to tell rails  
> > \>\> that the name of the rhtml file is the name of an action.  
> > \>  
> > \> Not really, the rhtml tells rails (or more precisely ActionView) that  
> > \> the file needs to be processed by erb. It really doesn't tell it that  
> > \> it's the name of an action, although if rails doesn't find an action  
> > \> method in the controller, it will by default look for a file to render  
> > \> in app/views/controller\_name. This file can be an rhtml file or  
> > \> something else (like a simple html file).  
> > \>  
> > \> Rhtml is html with embedded ruby. It does get processed on the server  
> > \> side by erb, or an equivalent program. What basically happens is that  
> > \> it get's turned into ruby code which writes out the html portions  
> > \> interspersed with the output from the embedded ruby code.  
> > \>  
> > \> There's not much to it in normal usage. The key concepts are that  
> > \> ruby code gets embedded within \<% %\> pairs, If the first \<% is  
> > \> followed by an = sign, then the value of the ruby expression following  
> > \> is inserted into the output.  
> > \>  
> > \> The client browser never sees the rhtml, only the (x)html which  
> > \> results from running erb.  
> > \>  
> > \> --  
> > \> Rick DeNatale  
> > \>  
> > \> My blog on Ruby  
> > \> [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
> > \>
> 
> --  
> [http://www.jeremymcanally.com/](http://www.jeremymcanally.com/)
> 
> My free Ruby e-book:  
> [http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)
> 
> My blogs:
> 
> > **[Site not found · DreamHost](http://www.mrneighborly.com/)**
> >
> > The owner of this domain has not yet uploaded their website.
> 
> [http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![Rick\_DeNatale1](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rick\_DeNatale1](https://rubytalk.org/u/Rick_DeNatale1)\
**Post date:** [21 March 2007 18:23 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/11 "2007-03-21T18:23:03Z")

</div>

Right, and in fact, rails URL/URIs typically don't have a dot  
extension. It's action pack which is looking at the files not Apache.  
The extension comes into play when the controller renders a view.  
Then Rails looks for a template file to render using conventions. E.g.  
if the FooController#display action renders, say, it's default view,  
the template will be looked for in app/views and if display.rhtml is  
found it will get processed by eRuby to produce the body of the HTTP  
response, or if display.rxml is found it will be processed by Builder.  
You can register template processors to handle other kinds of template  
files.

And Rails uses eRuby for other things, for example it runs  
config/database.yml through eRuby which lets you do a certain amount  
of dynamic configuration.

> **···**
>
> On 3/20/07, John Joyce \<dangerwillrobinsondanger@gmail.com\> wrote:
> 
> > You could use eRuby with any .extension  
> > In fact you could serve web pages with any or no dot extension.  
> > The key is that the server knows what to do with it.  
> > An example is Apache. You tell Apache what to do with files of  
> > various extensions. You could tell it to parse all .html files with  
> > Ruby, or all .php files with Perl.  
> > Thus, many rails pages show URL/URI with no dot extension at all in  
> > the web browser. It is important only if you use multiple language  
> > interpreters or your web application framework requires it.
> 
> --  
> Rick DeNatale
> 
> My blog on Ruby  
> [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![James\_Britt](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@James\_Britt](https://rubytalk.org/u/James_Britt)\
**Post date:** [21 March 2007 01:42 UTC](https://rubytalk.org/t/nees-rhtml-book/36263/12 "2007-03-21T01:42:57Z")

</div>

Read the whole post again and notice the part above.  
It is entirely true.  
Rails is a web application framework that requires it. It doesn't have to though. It doesn't even have to use ERb, it can use one of the other eRuby implementations such as eRubis. But these things take tinkering. Configuration.

> **···**
>
> On Mar 21, 2007, at 2:44 AM, Jeremy McAnally wrote:
> 
> > That's not entirely true; if you're using eRb with Rails, it requires  
> > that templates end in rhtml or erb. Otherwise, you could coceivably  
> > use it without an extension.
> > 
> > --Jeremy
> > 
> > On 3/20/07, John Joyce \<dangerwillrobinsondanger@gmail.com\> wrote:
> > 
> > > ...It is important only if you use multiple language  
> > > interpreters or your web application framework requires it.
