# How to include another rhtml from an rhtml (no controller)

**URL:** <https://www.ruby-forum.com/t/how-to-include-another-rhtml-from-an-rhtml-no-controller/104190>\
**Category:** Rails\
**Created:** [May 15, 2007, 7:51am UTC](https://www.ruby-forum.com/t/how-to-include-another-rhtml-from-an-rhtml-no-controller/104190 "2007-05-15T07:51:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinsonizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/848f3c/32.png) [@vinsonizer](https://www.ruby-forum.com/u/vinsonizer)\
**Post date:** [May 15, 2007, 7:51am UTC](https://www.ruby-forum.com/t/how-to-include-another-rhtml-from-an-rhtml-no-controller/104190/1 "2007-05-15T07:51:04Z")

</div>

I’m trying to do something simple like…

In \_email\_header.rhtml

\<% include “header.rhtml” %\>

Where \_header.rhtml looks like …

 \<%= image\_tag "logo.gif", :class =\> "logostyle" %\> 
- [**Request Service**](https://www.xyz.com)
- [Contact Us](https://www.xyz1.com)

The wrinkle is that main.rhtml is a template.

I’m trying to clone the look of my pages in my email…

Thanks,  
Jason

---

<div class="post-metadata">

**Author:** ![vinsonizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/848f3c/32.png) [@vinsonizer](https://www.ruby-forum.com/u/vinsonizer)\
**Post date:** [May 15, 2007, 8:04am UTC](https://www.ruby-forum.com/t/how-to-include-another-rhtml-from-an-rhtml-no-controller/104190/2 "2007-05-15T08:04:05Z")

</div>

render :partial =\> “main.rhtml”

2007/5/15, Jason V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> ```
> <%= image_tag "logo.gif", :class => "logostyle" %>
> </ul>
> 
> ```
> 
> >

## – Best Regards/Med Venlig Hilsen

## Frank Vilhelmsen Seniorkonsulent Cyber Com Consulting A/S mobil: +45 29483809 removed\_email\_address@domain.invalid [www.cybercomgroup.com/dk](http://www.cybercomgroup.com/dk)

[www.frankvilhelmsen.com](http://www.frankvilhelmsen.com)

---

<div class="post-metadata">

**Author:** ![vinsonizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/848f3c/32.png) [@vinsonizer](https://www.ruby-forum.com/u/vinsonizer)\
**Post date:** [May 15, 2007, 8:06am UTC](https://www.ruby-forum.com/t/how-to-include-another-rhtml-from-an-rhtml-no-controller/104190/3 "2007-05-15T08:06:05Z")

</div>

This is from rails docs.

Rendering a template

Template rendering works just like action rendering except that it  
takes a path relative to the template root. The current layout is  
automatically applied.

# Renders the template located in

[TEMPLATE\_ROOT]/weblog/show.r(html|xml) (in Rails,  
app/views/weblog/show.rhtml)  
render :template =\> “weblog/show”

Rendering a file

File rendering works just like action rendering except that it takes a  
filesystem path. By default, the path is assumed to be absolute, and  
the current layout is not applied.

# Renders the template located at the absolute filesystem path

render :file =\> “/path/to/some/template.rhtml”  
render :file =\> “c:/path/to/some/template.rhtml”

# Renders a template within the current layout, and with a 404 status

code  
render :file =\> “/path/to/some/template.rhtml”, :layout =\> true,  
:status =\> 404  
render :file =\> “c:/path/to/some/template.rhtml”, :layout =\> true,  
:status =\> 404

# Renders a template relative to the template root and chooses the

proper file extension  
render :file =\> “some/template”, :use\_full\_path =\> true
