A
Alvaro Bautista
I want to import rhtml files into another using ERB. I wrote a function:
def import(fn)
e = ""
File.open(fn) do |f|
e = ERB.new(f.read)
end
e.result
end
This function does what I want, reads the template file and processes it
returning the result string.
The problem is that if I do, for instance:
<html>
<body>
Some content
<%= import('some.rhtml') %>
</body>
</html>
The result contains only the some.rhtml processed file and the content
following the import line.
def import(fn)
e = ""
File.open(fn) do |f|
e = ERB.new(f.read)
end
e.result
end
This function does what I want, reads the template file and processes it
returning the result string.
The problem is that if I do, for instance:
<html>
<body>
Some content
<%= import('some.rhtml') %>
</body>
</html>
The result contains only the some.rhtml processed file and the content
following the import line.