Hi, I thought it would be fun to try to write a render method that
uses erb for rending.  I'm not much of a programmer, but I still like
to try:

module Test
  require 'erb'
  def render(m)
    ERB.new(IO.read("templates/layout.html")).result(binding) do
      ERB.new(IO.read("templates/#{m}.html")).result(binding)
    end
  end
end

This doesn't work of course, because I can't seem to figure out how to
pass a block to the layout.  I can make it work just rendering
index.html though.

layout.html:
<html>
<body>
<%= yield %>
</body>
</html>

index.html:
Hello <%= @name %>

Anyone willing to school me on this?!  :)

Thanks
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to