Apache Rivet
A Shaded Table

Example 2. A Shaded Table

In another simple example, we dynamically generate a table:

<?
    puts "<table>\n"
    for {set i 1} { $i <= 8 } {incr i} {
	puts "<tr>\n"
	for {set j 1} {$j <= 8} {incr j} {
	    set num [ expr $i * $j * 4 - 1]
	    puts [ format "<td bgcolor=\"%02x%02x%02x\" > $num $num $num </td>\n" \
		       $num $num $num ]
	}
	puts "</tr>\n"
    }
    puts "</table>\n"
?>

If you read the code, you can see that this is pure Tcl. We could take the same code, run it outside of Rivet, and it would generate the same HTML!

The result should look something like this:

Last Modified: 24-06-2009 16:20:32 UTC
Powered by Apache Powered by Tcl