Version 0 of THP

Updated 2005-11-25 23:44:25

CAU 25-Nov-2005: I finally got around to putting this page together. Something I've been meaning to do for at least 6 months.

THP is a way of embedding Tcl into HTML.

The requirements were quite straight forward. Some features are fairly obvious, others less so:

  • PHP, ASP and the like all allow the web developer to embed code directly into the markup language. I wanted to be able this with my preferred scripting language - Tcl.
  • I wanted to ensure that only complete commands were executed so simply using eval was out.
  • I wanted to be able to embed bits of HTML inside the code directly such as
 <%tcl while {$i<10} { %><B>Repeated line</B><BR><%tcl } %>
  • I wanted to be able to include other files by preparsing them (or pre-interpreting).
  • I wished to make the code as neat and fast as I could without making it unreadable (not sure if I've achieved either, you be the judge).
  • The code should be platform, server and client independent.
  • Using THP must be very easy.

Why THP? Well, it's a play on the PHP name - (T)cl (H)ypertext (P)reprocessor

I've been using THP now for a little while, tweaking where necessary, and think that it generally fits what it was supposed to do.

THP has been tested on:

  • Linux with Apache using both the standard interpreter (tclsh) and tclkit.
  • Windows XP/Server2003 with Tclhttpd using and IIS using tclsh and tclkit.
  • Windows XP/Server2003 with IIS and THP wrapped as a starpack.

I had some fun putting the starpack version together and figuring out IIS for the first time. Getting THP working with Tclhttpd outside of the cgi-bin directory was a challenge too, but it works a treat!

Check out a description and example at [L1 ]