rivet-2.2.4/ 0000755 0001750 0001750 00000000000 12630261051 012134 5 ustar manghi manghi rivet-2.2.4/doc/ 0000755 0001750 0001750 00000000000 12630261150 012701 5 ustar manghi manghi rivet-2.2.4/doc/examples.rvt 0000644 0001750 0001750 00000007044 07723457735 015310 0 ustar manghi manghi
Rivet examples |
These are some examples, rather limited ones, of what can be done with Rivet.
Hello world | |
<? cookie "foo" "bar" # we have to put this before any 'puts' statements puts "Hello world" ?> | |
Produces:
headers setcookie "foo" "bar" puts "hello world" ?>
| |
Conditionals: | |
<? if { 1 } { ?> <h2> True </h2> <? } ?> | |
Produces:
if { 1 } { ?> True} ?> | |
Loops: | |
<? set x 0 while { $x < 5 } { puts "\$x = $x<br>" incr x ?> LOOP<br> <? } ?> | |
Produces:
set x 0
while { $x < 5 } {
puts "\$x = $x | |
Variables (environmental as well as those passed to the script)
| |
<? hgetvars if { [ array exists VARS ] } { puts "< ul>" foreach { vr } [ array names VARS ] { puts "<li>(VARS) $vr = $VARS($vr)" } puts "</ul>" } if { [ array exists ENVS ] } { puts "<ul>" foreach { vr } [ array names ENVS ] { puts "<li>(ENVS) $vr = $ENVS($vr)" } puts "</ul>" } if { [ array exists COOKIES ] } { puts "<ul>" foreach { vr } [ array names COOKIES ] { puts "<li>(COOKIES) $vr = $COOKIES($vr)" } puts "</ul>" } ?> | |
Produces: hgetvars if { [ array exists VARS ] } { puts "
| |
Create a table on the fly
| |
<? set i 1 puts "<table>\n" while { $i <= 8 } { puts "<tr>\n" for {set j 1} {$j <= 8} {incr j} { set num [ expr $i * $j * 4 - 1] puts [ format "<td bgcolor=%2x%2x%2x > $num $num $num </td>\n" $num $num $num ] } incr i puts "</tr>\n" } puts "</table>\n" ?> | |
Produces: set i 1 puts "
| |
In addition There are many, many other things you can do with Rivet. You can, if everything is compiled right, load tcl modules, like libpgtcl.so (the Postgresql interface), so that you can interact with a database!
|