Forum: Ruby on Rails How to include another rhtml from an rhtml (no controller)..

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
55b646f35b70676d62dcca1763a66cef?d=identicon&s=25 Jason Vogel (Guest)
on 2007-05-15 07:51
(Received via mailing list)
I'm trying to do something simple like...

In _email_header.rhtml

 <% include "header.rhtml" %>

Where _header.rhtml looks like ...

<div class="bdy90">
  <%= image_tag "logo.gif", :class => "logostyle" %>

  <ul id="topnav">
    <li>
      <a class="request" href="https://www.xyz.com">
        <strong>Request Service</strong>
      </a>
    </li>
    <li>
      <a class="contact" href="https://www.xyz1.com">Contact Us</a>
    </li>
  </ul>
</div>

The wrinkle is that main.rhtml is a template.

I'm trying to clone the look of my pages in my email...

Thanks,
Jason
5cec1e80eca38c9ac711f568ba4ae4f5?d=identicon&s=25 Frank Vilhelmsen (Guest)
on 2007-05-15 08:04
(Received via mailing list)
render :partial => "main.rhtml"



2007/5/15, Jason Vogel <jasonvogel@gmail.com>:
>         <%= image_tag "logo.gif", :class => "logostyle" %>
>         </ul>
> >
>


--
Best Regards/Med Venlig Hilsen
-------------------------------------
Frank Vilhelmsen
Seniorkonsulent
Cyber Com Consulting A/S
mobil: +45 29483809
frank.vilhelmsen@cybercomgroup.com
www.cybercomgroup.com/dk
-------------------------------------
www.frankvilhelmsen.com
5cec1e80eca38c9ac711f568ba4ae4f5?d=identicon&s=25 Frank Vilhelmsen (Guest)
on 2007-05-15 08:06
(Received via mailing list)
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
This topic is locked and can not be replied to.