Write CGI Scripts
These are guidelines for writing cgiscripts to work with vov.
HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: the length of the HTML page
<<-- Will not work without this empty line!!
The content of the HTML page
- writing the CGI script as a Tcl script;
- taking advantage of the procedures defined in VOVDIR/tcl/vtcl/vovhtmlgen.tcl.
Simplest CGI script
#!/bin/csh -f
# The rest is -*- Tcl -*- \
exec vovsh -f $0 $*
# Try this by means of the URL /cgi/ciaobello.cgi
VOVHTML_START
HTML {
HEAD { TITLE "Ciao bello example" }
BODY {
OUT "CIAO BELLO"
}
}
VOVHTML_FINISH
Retrieving VOV information
#!/bin/csh -f
# The rest is -*- Tcl -*- \
exec vovsh -f $0 $*
# This script responds to a URL of type: /cgi/getnode.cgi?nodeid
set id [shift]
VOVHTML_START
HTML {
HEAD { TITLE "Get Node $id" }
BODY {
H1 { OUT "Node $id" }
set nodeInfo [vtk_node_get $id]
TABLE {
foreach field { status barrier timestamp type } {
TR {
TH { OUT $field }
TD { OUT [shift nodeInfo] }
}
}
}
OUT "CIAO BELLO"
}
}
VOVHTML_FINISH