From: Brian Candler Date: 2011-02-24T07:16:59+09:00 Subject: Re: Show text from text file in cgi script Ryan C. wrote in post #983261: > Here's what I've got: ... > puts < > > > Oliver Twist > > > > <% File.open("oliver_twist.txt").each { |line| puts line } %> > > > HTML puts inside puts is bad. Look, what you're doing is simply this: puts "A very big string indeed" The only difference is that you've written the string in the multiline form, also known as a "here-doc": puts < <%= @title %> <%= yield %> @@ book
<%= @content %>
---------------------------------------------------------------- Do "gem install sinatra", then just run this code from the command line (ruby myapp.rb). It will start a webserver listening on port 4567. There are other options for when you want to deploy the app for real. HTH, Brian. -- Posted via http://www.ruby-forum.com/.