Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

The ease of PHP with the power of Ruby

By Peter Cooper / August 27, 2006

require 'rubyhp'
  <% cgi.params.each do |key, value| %>
   <%= key %>: <%= value %><br />
  <% end %>
  <% if cgi.params.empty? %>
   Sorry, please enter some cgi parameters. How about "?foo=baz"?
  <% end %>

Christopher Cyll has put together a great little example of how to quickly create templated Web pages with Ruby without requiring any frameworks. It relies on CGI, but sometimes that's all you need, and it makes throwing together tiny Ruby-powered Web pages possible as easy as creating a simple PHP page.


  1. AnĂ­bal Rojas says:

    What about:

    It is a little bit more elaborated, but almost the same. And I agree with you, not everything is a "application" there is a lot of space for quick n' dirty small scripts

  2. Christoffer Sawicki says:

    A slightly better way:

  3. James says:

    One of the things I like about Ruby's Nitro Web framework is that it makes it very easy to build dirt-simple, ASP/PHP-like pages, while providing a good migration path to more a sophisticated ORM/MVC-style architecture if you need that as the application evolves.

Other Posts to Enjoy

Twitter Mentions