Theme is a simple tool that wraps a template around a webpage to easily set up a consistant appearance for all the pages in a website. It can be run as a cgi script with ScriptAlias or it can be run from the command line as a (sort of regular) program.


When started, it looks for the file page.them in the current directory, then in each of the parent directories up to the document root. If it doesn’t find one, it fails, but if it finds one, it copies it out, doing various substitutions on it as it goes. If theme encounters a <?theme command?> html command, it substitutes

The webpage that you’re trying to view
The current directory (for example, if you’re looking at, <?theme cwd?> is /~orc/Code/theme.)
The path to the directory where page.theme was found. If you’re looking at, and the theme is at, <?theme root?> is ../../.
The title for the page (as set in the page itself, see below) bracketed by <title> and </title>.
<meta/ > tags for the page.
The contents of the variable name. In most cases, <?theme command?> is the same as <?theme $command?>, with the notable exception of <?theme title?>, which adds <title> and </title> to the output while <theme $title> does not.

Contents of the webpage

You can set various things in the webpage itself, by defining them at the top of the page before any of the content. When theme runs, it picks any variables (set by set name:=rest of line) out of the file and saves the rest of the file for inclusion in page.theme. You can also set some of the variables by an obsolete method of name:rest of line

same as set sccs
same as set title
same as set meta except that multiple meta: lines will concatenate into one big meta variable.


  1. Currently, theme only works on user pages. If the page you give it doesn’t start with a /~user, theme will cheerfully spit out an error page and quit.
  2. Theme doesn’t play well with other cgi scripts. If you have dynamic content, you can’t use theme in a ScriptAlias, but must run it from the command line.

Building theme

Theme uses my configuration system, which is sort of like the FSF’s system (except that you run instead of configure). The --help option tells you all the settings you can change. There are two custom settings that are important to properly set;

  1. --with-user-dir sets the directory under /~user which contains their html files. This is normally htdocs, but can be set to anything (including ., which makes all of that users files accessable to theme and the rest of the world .)
  2. --with-pages changes the types of files that theme will process. If this is not set, theme will only process files that have a .html or .htm extension. Provide a colon-separated list of extensions to change this.

Source Code

version 0.01
This is the first public release. Note the complete lack of documentation, readmes, or anything other than the configure scripts and source files.