When modruby/eruby isn't available

I’m not a web programming expert, so please bear with me…

I’d like to generate some web pages on demand from some templates (HTML
with embedded Ruby code) or perhaps use some combination of templates and
YAML files. My ISP installed Ruby at my request several months ago, but
I’m not as optimistic that they’ll install modruby and/or eruby. So,
without modruby or eruby, what would be the best way to go about doing
this - or is it possible at all?

Phil

I like using PageTemplate and running the script as a CGI.
http://pate.eylerfamily.org/cgi-bin/index.rb is a simple example
of what you can do. It currently generates pages in about:
real 0m0.061s
user 0m0.040s
sys 0m0.000s

It’s making 4 mysql connections, and drawing on 5 temmplates to build the
page …

-pate

···

On Thu, 27 Mar 2003, Phil Tomson wrote:

I’m not a web programming expert, so please bear with me…

I’d like to generate some web pages on demand from some templates (HTML
with embedded Ruby code) or perhaps use some combination of templates and
YAML files. My ISP installed Ruby at my request several months ago, but
I’m not as optimistic that they’ll install modruby and/or eruby. So,
without modruby or eruby, what would be the best way to go about doing
this - or is it possible at all?

Phil

A few templating systems take YAML documents directly.

Amrita.
[http://www.brain-tokyo.jp/research/amrita/sources/sample/tour/amsyaml.ams]
The XTemplate library. [Using XTemplate::YAMLDocument]

Any templating system that can take a Ruby Hash or data structure will allow
YAML loading, though.

require ‘amrita/template’
require ‘yaml’
include Amrita

tmpl = TemplateFile.new( “template.html” )
data = YAML::load( File.open( “template.yml” ) )
tmpl.expand( STDOUT, data )

With PageTemplate:

require ‘PageTemplate’
require ‘yaml’

template = PageTemplate.new()
template.load( “/var/www/templates/template.txt” )
template[‘config’] = YAML::load( File.open( “/var/www/config.yml” ) )
print template.output

You’ll be fine without eruby and mod_ruby.

_why

···

On Wednesday 26 March 2003 12:09 pm, Phil Tomson wrote:

I’d like to generate some web pages on demand from some templates (HTML
with embedded Ruby code) or perhaps use some combination of templates and
YAML files.