Hello World
As with any tool, it's always nice to see something work, so let's create a small "Hello World" page.
Assuming you have Apache configured correctly, create a file
called hello.rvt
where Apache can find
it, with the following content:
<html> <head> <title>Hello World</title> </head> <body> <pre> <b><? puts "Hello world" ?></b> </pre> </body> </html>
The example can be elaborated, for example using the html command
<? set hello_message "Hello world" ?> <html> <head> <title><? puts $hello_message ?></title> </head> <body><? puts [::rivet::html $hello_message pre b] ?></body> </html>
Starting with version 2.0.5 Rivet also supports a shorthand notation to output simple strings.
<? set hello_message "Hello world" ?> <html> <head> <title><?= $hello_message ?></title> </head> <body><?= [::rivet::html $hello_message pre b] ?></body> </html>