Updated 2013-10-18 21:57:25 by Jorge

JM 29 Dec 2012 - When reading about Templates and subst on this wiki, I came across this web page [1] and wanted to give it a try, on my Windows XP (and Ubuntu) PC.

For Windows: the apache installer can be found at [2] (it was installed under: C:\xampp)

These are the steps I have taken to setup this script and learn during that process (thanks AMG):

1.- Copied the tcl script [3] to my cgi-bin folder.
 Windows: C:\xampp\cgi-bin
 Ubuntu: /usr/lib/cgi-bin

2.- Copied the site.css (to my docroot folder) from [4] in order to get the nice and simple style that you see there.
3.- Created a .htaccess file on my docroot folder
 Windows: C:\xampp\htdocs
 Ubuntu: /var/www

with the following contents:
# Enable URL rewriting.
RewriteEngine on

# Just let Apache send/process the file if it already exists.  This rule also
# prevents an infinite rewrite loop, since the rewrite maps to an existing file.
RewriteCond %{REQUEST_FILENAME} !-f

# Generate all directory listings, phony files, etc. with a script.
RewriteRule ^ /cgi-bin/site.tcl [L]

# Hide dotfiles.
<Files ~ "^\.">
   Order deny,allow
   Deny from all
</Files>

4.- Modified the site.tcl script to match my "site" (these are the few lines that I modified)
# Configuration.
set ::docroot xampp/htdocs
set ::baseurl http://localhost

Of course, you should also modify the mail and timezone variables for your own page.
5.- Finally, I just made a file called .desc (on my docroot folder) which contains simple lists which elements are:

Here a sample content of such file:
{title1 1356737274 "some content"}
{title2 1356737274 {some <a href="http://andy.junkdrome.org/">Andy</a> more content}}
{title3 1356737274 "some more content"}
{title4 1356737274 "and more content"}
{title5 1356737274 "some content"}
{title6 1356737274 "some content"}
{title7 1356737274 "some content"}
{title8 1356737274 "some content"}
{title9 1356737274 "some content"}
{titleA 1356737274 "some content"}
{titleB 1356737274 "some content"}
{titleC 1356737274 "some content"}

Key Paths on ubuntu:
DescriptionPath
Apache configuration/etc/apache2
DocumentRoot/var/www
ScriptAlias/usr/lib/cgi-bin
Tcl/usr/bin/tclsh

Final Notes:

  • .htaccess and .desc files are getting listed on my Windows PC, on Unix though, [glob *] skips dotfiles, at least 8.5.2's [glob] does. (As AMG explained to me). This is not good, but at least, its access is still forbidden. (I Think you could modify the glob statement on the site.tcl script to omit such files)
  • I have not explored yet the templatized html feature included on the script, that is a "to be continued" kind of thing...
  • Also, you will have a slot with a missing image on top of the page, for your site's logo/banner
  • You cannot create a .desc or .htaccess from the file explorer GUI in windows, you can however, create the files from DOS and/or wish