From: patrick-may@... (Patrick May) Date: 2002-08-17T11:57:57+09:00 Subject: Re: .rhtml files and server-side includes? sera@fhwang.net (Francis Hwang) wrote in message news:<7b561b93.0208151658.6f1f9dc5@posting.google.com>... > Another CGI-type question: Is it possible to use server-side includes > with .rhtml files? What does the syntax look like? You can do something like this: def to_html( template ) template = @site.assets_dir + "templates/" + template + ".rhtml" code = "page=self; site=page.site;\n" File.open( template, "r" ) { |file| compiler = ERuby::Compiler.new code += compiler.compile_file(file) } io = MockIO.new $defout = io eval( code ) $defout = $stdout io.read end MockIO can be a StringIO if you're using 1.7(?), or something that you roll together yourself. Not exactly an include, but kinda serves a similar purpose. ~ Patrick