# we have complete access to the interpreter here, so it is best to # run per-page code in a namespace, just like we do with .rvt pages. proc getcode { filename } { set fl [ open $filename r ] set sourcecode [ read $fl ] close $fl regsub -all "&" "$sourcecode" "\\&" sourcecode regsub -all "<" "$sourcecode" "\\<" sourcecode regsub -all ">" "$sourcecode" "\\>" sourcecode return $sourcecode } if { ! [ info exists header ] } { set header { .tcl example } } if { ! [ info exists footer ] } { set footer { } } namespace eval request { hgetvars puts $header puts {

This is an example of a .tcl file being processed in Rivet

Here is the source code:


    }
    puts [ getcode $ENVS(SCRIPT_FILENAME) ]
    puts {
	

} puts $footer }