THT provides self-contained web scripting.
No Apache modules are required.
In fact, there are no external dependancies!
All you need is Tcl 8.3 or greater
(releases from 2000 on should work).
If your ISP supports CGI and is running Linux, there is a good chance Tcl is
already installed and you can start using THT immediately (see Installation).
If you run your own site,
Tcl is one of the easiest and most painless packages to build and install.
(However, virtually every Linux distribution already includes Tcl, so building it is not usually required.)
THT can even use FastCGI if you have it,
don't have FastCGI, you can emulate it with SockCGI.
THT itself is written in just a few thousand lines of Tcl,
leaving virtually everything open to inspection, correction and improvement.
And for embedded use, Tcl is hard to beat.
A THT script file uses the file extension .tht.
Typically this is just plain HTML with Tcl code embedded inside
<?tht ... ?> escapes. eg.
echo "<B>Hello world</B>"
In addition to the standard Tcl commands, THT
builtin commands. Some of these
are simple commands such as echo which is used to
output HTML to the page.
While others, such as html, are compound commands
using Mod. A Module is a namespace containing
a collection of sub-commands. Some of these sub-commands may in turn be Modules, etc.
Currently THT uses several global array variables for runtime use. These include:
|QUERY||Elements from the query string.|
|THT||Various control variables.|
|COOKIES||Cookie name/value pairs.|
|FILES||File names from uploads.|
See the ''Dump all' example in Examples for sample output.
THT may also be hidden in a document using <!--<?tht ... ?>--> (note there
must be no spaces in between). Browsers will ignore the inline code but THT
will process it just fine.
For the security minded, THT scripts are easily secured within Safe-Tcl.
Also procs in THT use introspective documentation: The documentation
is extracted from the comment at the top of each proc
using Tcl introspection mechanisims.
While no incredible claims will be made about THT performance, it is able to use
If you think PHP or other embedded servers are unbeatable, perhaps you might like to
read some of the links off of the FastCGI page. In particular:
A Comparison of Portable Dynamic Web Content Technologies for the Apache Server.
© 2008 Peter MacDonald