From: Armin Roehrl Date: 2001-12-20T08:25:37+09:00 Subject: [ruby-talk:29035] Re: CGI problem On Thursday 20 December 2001 00:08, you wrote: > hello > > I have a basic question on the CGI module. > > I have this code: > > require "cgi" > cgi = CGI.new("html4") > cgi.out { cgi.head { cgi.title{"testtitle"} } } > cgi.out { cgi.body { cgi.h1 { "linux rules" } } } > cgi.out { cgi.h1 { "ruby rules" } } > > but the 2nd and 3rd cgi.out call are never executed > I get an empty page with only this source code > > > testtitle > > > but when I have a bigger cgi programm I have html output at different > places and then I need cgi.out several times. > is there a may to call it multiple times or is this just some kind > of misunterstanding of the whole cgi module. > > thanks in advance for any answer What I would do: require "cgi" class A def initialize @html='' @cgi=CGI.new("html4") end def head @cgi.head{ @cgi.title{ "test"}} end def body @cgi.body { bla } end def bla "the mega long body here" +@cgi.br + "bla bla" end def sendTheFout @cgi.out{ head + body } end end a=A.new a.sendTheFout Bye Armin. ----------------------------------------------- Armin Roehrl, http://www.approximity.com