The Trajan web site is built around an PostgreSQL database. There
are two tables in this DB:
- the first one contains all the content for the database pages
and it is composed of 510 records, each with 21 fields.
- the second table contains the image map coordinates for the
cartoon pages, and it is composed of 24 records with 3
The "Database" Section
There are two main CGI scripts written in PERL which interface with this database and extract information to build pages on-the-fly.
The "Database" pages are built on-the-fly by a CGI script which is
passed a record number in the link. The CGI takes this number, calls
the database, extracts the relevant information and puts it together
to form a web page. This dynamically produced web page contains a
number of links to different parts of the site:
- Links to different resolutions of the image displayed
- The images are name according to the convention <CD
number>.<image number>.<resolution>.jpg. The naming
convention is important since we are dynamically producing links
to different resolutions.
- Cartoon link
- The cartoon link contains a spiral number (1-24) and a side of
column letter (a-d). There are different images and related links
for all cartoons and for each side of column. This number is
extracted from the DB to build the link.
- Links to related images
- The "Related Images" links are a bit more complex than the
other links, they in fact call the same script, but with a slide
number and a boolean value (true or false). If the boolean value
is "true", then the script passes a slide number to the database
instead of a record number and constructs a web page.
- Links to the next and previous record
- These links are formed by incrementing and decrimenting the
current record number in the range of 1-510.
The "Cartoon" Section
The "Cartoon" pages are also built on the fly. The naming
convention here is also important. There are 4 copies of each spiral
view, each of which has its particular panel highlighted, and each is
named after its spiral number and panel number, e.g. pics<spiral
number><panel number>.gif. Therefore, there is a
corresponding spiral for every panel.
- Spiral view (top cartoon)
- All spiral pictures have the same dimentions so this makes
image map construction simple. The coordinates were manually
calculated and entered into the DB, but the page they point to is
built dynamically based on the spiral and panel number.
- Next and previous spiral and panel navigation bar
- This is an image map where the coordinates are the same on
every page, but the links are produced by incrimenting and
decrimenting the number of the current spiral and panel with in
the range of 1a-d ..24a.
- Spiral navigation bar
- This image map that is the same on every cartoon page.
- Panel close up
- On many of the panels there are blue boxes which link to other
detailed pictures in the database. The coordinates were manually
calcualted for each panel and entered into a DB. Then, when the
cartoon page is built, a DB call is made asking for image map
coordinates for the panel (if any) and the image map is
- Links to high resolutions of the panel and the entir
- These are link to high resolution versions of the panel and
- Links to the associated slides
- These are links to all other records which refer to the
current spiral number. When the cartoon page is created ad DB call
is made and links are built for all records that contain an image
from the current spiral.
The indices contain links to keywords, scene numbers, side of
column, drum and spiral numbers. This information is extracted by a
PERL script and dumped into a static web page for easy and efficient
access. This script can be run whenever there is a change in the DB
(or put in a cron script for nightly update) content to produce a new
set of indices.
The Search Page
The Search page is a CGI script which can search for one or more
strings in a number of different fields. The search strings are
gathered by the script, filtered for validity and an SQL query is
created and executed. The results are formatted into a list of
hyperlinks for the user to peruse.
I have included links to the source code below. All CGI scripts are written in PERL and take
advantage of the Pg.pm interface to a PostgreSQL database and (to some extent) the CGI.pm modules. Keep in mind that these scripts are
designed for the Trajan site specifically and I post them here so that others may use bits of code or
rewrite parts to suit there own projects. These scripts are Copyright 1999, Paul Barrette and the Trajan Column Project. If you use them
please keep the copyright information at the head of the script intact.
The McMaster Trajan Project, 1999