Another CGI-type question: Is it possible to use server-side includes
with .rhtml files? What does the syntax look like?
Assuming you’re using apache there is IMHO no way to post process .rhtml
file with mod_include.
-billy.
···
On Fri, Aug 16, 2002 at 10:15:49AM +0900, Francis Hwang wrote:
Another CGI-type question: Is it possible to use server-side includes
with .rhtml files? What does the syntax look like?
–
Meisterbohne Söflinger Straße 100 Tel: +49-731-399 499-0
eLösungen 89077 Ulm Fax: +49-731-399 499-9
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