RE: how to include an html file?


#1

Other then that though you could simple open the file and
spit the results manually. So, a simple helper function:

def include_page(file_name)
result = “”
File.open(file_name, “r”) { |f| result << f.read }
result
end

That can be shortened to:

def include_page(file_name)
IO.read(file_name)
end

Regards,

Dan


#2

Of course it can! :slight_smile:
Thanks for that, there seems to always be a ‘shorter’ way in ruby!


#3

Thanx guys!


#4

OR:

<%= render :file => ‘/absolute/full/path/to/file’ %>

And that will interpret any erb thats in the file as well.

Cheers-
-Ezra