From 0d15e9501c96d4ee08c91c523f7329135d0f3c5e Mon Sep 17 00:00:00 2001 From: makoto kuwata Date: Sun, 27 Jun 2010 22:19:19 +0900 Subject: [enhance] support layout template in 'contrib/index.cgi' --- contrib/index.cgi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/index.cgi b/contrib/index.cgi index d740e4e..6e948fb 100644 --- a/contrib/index.cgi +++ b/contrib/index.cgi @@ -11,6 +11,7 @@ include Erubis::XmlHelper ERUBY = Erubis::Eruby # or Erubis::EscapeEruby @encoding = nil +@layout = '_layout.rhtml' ## helper class to represent http error class HttpError < Exception @@ -40,6 +41,11 @@ begin ## process as eRuby file eruby = ERUBY.load_file(filepath) # or ERUBY.new(File.read(filepath)) html = eruby.result() + ## use layout template + if @layout && File.file?(@layout) + @content = html + html = ERUBY.load_file(@layout).result() + end ## send response print @encoding \ ? "Content-Type: text/html; charset=#{@encoding}\r\n" \ -- cgit v1.2.1