Site Evolution

In the beginnining a lot of code making up the tables and navigation buttons was repeated on each page. This meant bigger files and having to edit each page every time the buttons changed. Not that huge a chore, given the replace-to-disk tools in my armoury, but that repeated code made each page slower to download.

My solution to was to give the job of creating the new navigation bars and main table over to a piece of JavaScript, which could be placed in a separate file and called from anywhere on the site. This is slightly more complicated than it at first sounds...

The navigation bars call graphics from a shared resources directory on the root directory of my site. This means that in order to use those graphics in the navigation bars, and work out which pages to link to, a means had to be found to work out where a page was in the directory hierarchy, so that it could be given the correct path for those graphics. The easy way of doing this would have been to set one URL (http://denyer.cjb.net/shared) at the start of the script, and have done with it. However, this would have meant that my pages wouldn't show their navigation bars offline, which would have made testing them prior to upload difficult. Therefore, the general code for the JavaScript first checks whether it is on or offline — if off, it works with the directory path on my harddisc instead of the online URL. There's also some code in there to work out what the root page of each page is, stopping the navigation bar getting cluttered.

The main table itself is sized appropriately depending on the size of the user's screen, since people using 640x480 resolutions need to conserve as much space as possible. 800x600 or larger viewers will get aesthetically pleasing white margins.

Browsers which don't support JavaScript (or aren't using it) get a short but polite message at the foot of every page pointing out that the page would look a lot better and be easier to navigate if they had it, and links back to the contents page and my guestbook. This way, every page remains accessible to users who can't easily upgrade or modify their browser settings.

Finally, each page has a cascading stylesheet attached which replaces the need for dozens of font tags on every page, and particularly those within tables (fonts have always been badly handled here.) More disc space and hassle saved again. Hooray!