# Erb and rhtml templates?

**URL:** <https://www.ruby-forum.com/t/erb-and-rhtml-templates/143176>\
**Category:** Ruby\
**Created:** [July 16, 2008, 12:40am UTC](https://www.ruby-forum.com/t/erb-and-rhtml-templates/143176 "2008-07-16T00:40:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![labyrinth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed8c4c/32.png) [@labyrinth](https://www.ruby-forum.com/u/labyrinth)\
**Post date:** [July 16, 2008, 12:40am UTC](https://www.ruby-forum.com/t/erb-and-rhtml-templates/143176/1 "2008-07-16T00:40:04Z")

</div>

I’ve got a website w/ lunarpages, and I’ve been using erb to do some  
things w/ my pages. Everything has worked well so far.

My problem is, my main pages each call in header and footer templates,  
but I can’t figure out how to get the server to evaluate the templates  
if they are .rhtml files w/ embedded ruby code.

## I’ve tried:

\<% require ‘erb’  
def import\_erb path  
ERB.new(File.read(path)).result()

# or ERB.new(File.read(path), nil, nil, ‘_x_’).result()

end  
%\>

# and then

## \<%= import\_erb(‘footer.rhtml’) %\>

But I get a ‘500 internal server error’. If I leave out the .result  
call, there’s no problem. I wonder if it’s lunarpages or my fault.

---

<div class="post-metadata">

**Author:** ![labyrinth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed8c4c/32.png) [@labyrinth](https://www.ruby-forum.com/u/labyrinth)\
**Post date:** [July 18, 2008, 8:40pm UTC](https://www.ruby-forum.com/t/erb-and-rhtml-templates/143176/2 "2008-07-18T20:40:30Z")

</div>

Du De wrote:

> But I get a ‘500 internal server error’.

Figure out where your server sticks your error\*log file (either  
error.log or  
error\_log) and tail it. You must start with the actual error message!

---

<div class="post-metadata">

**Author:** ![labyrinth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed8c4c/32.png) [@labyrinth](https://www.ruby-forum.com/u/labyrinth)\
**Post date:** [July 21, 2008, 9:19pm UTC](https://www.ruby-forum.com/t/erb-and-rhtml-templates/143176/3 "2008-07-21T21:19:01Z")

</div>

Phlip wrote:

> Du De wrote:
> 
> > But I get a ‘500 internal server error’.
> 
> Figure out where your server sticks your error\*log file (either  
> error.log or  
> error\_log) and tail it. You must start with the actual error message!

Actually, that is from the error log. It is no more informative than  
that.
