Home  1999-2001  2002-3  2004-6  2007  2008  2009  2010  2011
 Coastwalk  LE-JOG  Counties  Random Search within km of
Hiking in Britain

The scripts that run this website


Background

Management of data on websites can be a difficult and time-consuming task. Take this example: An image is embedded within a page, and the website author decides that it needs trimming. He then needs to discover every place that the image is used and change the image size accordingly.

For one image this is an easy task, but with multiple ones it can be a nightmare - especially when a website has many hundreds or thousands of photographs to be precoessed in this manner. To get over many of these sorts of problems this website is generated from a series of template files which are parsed into HTML by Perl scripts.

These scripts have been through an evolutionary rather than a design process, which means that they are not necesarilly as clear and well-written as they should be. This is improving over time as I go through them and give them ground-up rewrites and fix bugs, but the lack of time means that this is necessarily a slow process.

The scripts have a series of aims:

  • To make the maintenace of the website easier;
  • To automatically generate items (such as maps used or amounts of walking done)
  • To ensure that the pages adhere to web standards (amainly the W3C rules);
  • To make the website have an internally consistent look and feel.
  • To make it easier to ensure that the externally-visible website matches that held on the unix box.

The scripts

The list below outlines the scripts that are currently used.

  • PerlLib. This perl library contains a series of routines that are used by all the other scripts. There are two main areas of functionality; parsing a template walks file for information; and copying a template file into an HTNL file, performing tag substitution as it goes.
  • OSLib. This script parses through all the walks files and uses them to produce a map of walks that have been completed and another map of walks that have been completed and are to be done. These maps include other features such as the highest point of every county, and help me plan which walks need to be done next. The mapsproduced are in two formats; an Acorn-specific !Draw vector format, and a web-standard Scaled Vector Graphics (SVG) format. Althoygh a GIF created from the !Draw file is currently used on the main walks menu page, I would expect the SVG file to replace it soon.
  • Photos. This script deals with all the photo issues on the webpages. It creates HTML files for each photo, and a large HTML page containing all photos that are contained in the website (and some that are not). To do this it goes through all the directories in the site and looks at any JPEG's that it finds. It expects to find two copies of each image - large (the large copies of the image), and small (the thumbnail copies). It records both of these sizes in an array and reads the relevant descriptive text from another file. When an InserPhoto XXNN is spotted in a file, it converts this into an HTML fragment to insert the thumbnail into the page.
  • SaneJPEGS. Much of the work in writing the files for this website are done on an Acorn RiscPC computer. This uses a different filetyping system to Unix and DOS computers, and therefore to maintain this information on Unix servers filenames are altered. For instance a JPEG file foo.jpg becomes foo.jpg,ddc. This script recurses through all the directories and alters the files to the correct form.
  • Counties. This script deals with two things; it generates the CountyTop page which outlines all the county tops in Britain, and it also generates the list of all the counties that have been visited.
  • MainIndex. This script lists all the walks done in one file, producing a main index file for all the walks that have been completed.
  • GenWalk. This takes a series of template files and generates HTML files from them. It parses the files and looks for tags that denote legs and stages of a particular route. It then uses these to show how much of the route has been completed and how much remains to be done. This data can then be used to generate an itinerary of thw walk, based on a start date and a maximum distance to be waled each day. This script replaces the LEJOGS script, and provides a superset of that scripts functionality.
  • checklinks. This script parses through the website from the site index page and follows all links. It looks at all the extneral links and if they are not available then it is flagged up as being missing, helping me keep track for dead external links. It also shows me if I have broken any internal links within the site, which is possible of one of the scripts above has gone askew. Finally it produces a list of all the files in the website held locally, along with their sizes and their checksums. This information allows the WebUp script to decide when files have been altered and hence need uploading to the website.
  • WebUp. This script takes the output file from the checklinks script (showing all the local files that are linked to from the main index page) and another showing the current contents of the website and creates a tarfile with any files that have been updating, meaning that uploading altered files to the website is made easy. The list of files that is being compared against is also uploaded to te website, so that it can be used next time it needs updating.


Valid HTML 4.0!