Erb and rhtml templates?

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.

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!

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs