From: Phrogz Date: 2007-07-13T03:55:01+09:00 Subject: Re: Ruby and PHP code in html-page On Jul 12, 12:43 pm, Jeremy Henty wrote: > On 2007-07-12, John Joyce wrote: > > > With php you can just include a file, but ERb doesn't let you do > > that (AFAIK). > > <%= IO.read "yes_it_does.txt" %> Not quite when you want the included file to have ERB commands in it: C:\>type main.erb <%=$foo%> <%=IO.read('inc.erb')%> C:\>type inc.erb <%=$foo%> C:\>irb irb(main):001:0> require 'erb' irb(main):002:0> $foo = 'Hello World' irb(main):003:0> ERB.new( IO.read( 'main.erb' ) ).run Hello World <%=$foo%>