erb and rhtml templates?

Discussion in 'Ruby' started by Du De, Jul 15, 2008.

  1. Du De

    Du De Guest

    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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Du De, Jul 15, 2008
    #1
    1. Advertising

  2. Du De

    Phlip Guest

    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
     
    Phlip, Jul 18, 2008
    #2
    1. Advertising

  3. Du De

    Du De Guest

    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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Du De, Jul 21, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joao Pedrosa
    Replies:
    8
    Views:
    271
    Joao Pedrosa
    Oct 12, 2004
  2. Belorion

    Webrick, erb, and .rhtml

    Belorion, Jan 12, 2005, in forum: Ruby
    Replies:
    13
    Views:
    471
    Nicholas Van Weerdenburg
    Jan 19, 2005
  3. Paul
    Replies:
    1
    Views:
    178
  4. Martin Nemzow
    Replies:
    0
    Views:
    110
    Martin Nemzow
    Jun 8, 2006
  5. Glenn
    Replies:
    1
    Views:
    150
    F. Senault
    Jan 10, 2009
Loading...

Share This Page