Code making

I spent most of today programming.  Yes, you read that right, I was programming.  Not something I do much these days, in fact, something I’ve been consciously avoiding since finishing my Computer Science degree.  But there are times when in order to go forwards you first need to go backwards.  So I spent the day trying to remember everything I learnt about MySQL, and spent a good long while perfecting a script to give people access to a database of contact information for the Diocese of Chelmsford web site.

Actually it turned out to be less complicated than I was expecting.  I ended up spending more time getting the visual components working properly than ironing out SQL bugs.  Don’t worry, I’m not about to go off on another rant about browser compatibility, tempted though I am!  The code is now more or less finished, and all that is left is for me to do some testing before letting it loose on the public, at which point we will have an online version of the Diocesan Directory, allowing visitors to search through several thousand records to find contact details for their local vicar, PCC treasurer, chaplain, etc.  Pretty neat.  But I think I’m most pleased with the interface, which is quite smart and echoes some of the styling found in Google and Apple’s iCal program!

Technically there is very little that’s particularly complicated about the database, since it’s just one flat table, no link tables, no multiple dependencies.  I think actually the most impressive part about it is that when it comes to displaying the results it only shows what it’s got, and doesn’t leave spaces where the information would have been, which is achieved simply by placing each element in its own if clause.

Visually, I’m most pleased with the opening page, which includes a drop down section all done with CSS.  By default the page shows a “Quick Search”, giving you just a couple of boxes to fill in and a search button.  Underneath is a small box with the words “Advanced Search” which, if clicked on, opens up to show a more comprehensive list of options.  Fairly intuitive, but while a lot of web programmers might have resorted to Javascript to make this happen, I’ve done it all with some fairly simple CSS, which is far faster.  What’s even more impressive is that it actually works on all the browsers I’ve been able to test it on, including Firefox, Opera, Safari, IE6 and IE5 for Mac, and given how much grief Microsoft’s offerings cause me that’s pretty good going.

3 thoughts on “Code making

  1. when it comes to displaying the results it only shows what it’s got, and doesn’t leave spaces where the information would have been, which is achieved simply by placing each element in its own if clause.

    Um…. what? If you hadn’t have put each element in its own “if” block, would it have made up some data? I’m a bit confused as to what you did there!

    If you want some testing done with Firefox on Linux let me know 🙂

  2. Sorry Phill, to clear that confusion up, if a variable is empty and you just output it anyway, you effectively end up with a blank line where you don’t want one. This is particular an issue when printing an address, where you want different things on separate lines, but where the database doesn’t always contain data in each field. It’s a purely aesthetic thing, I just wanted to make sure that the addresses were displayed perfectly, only showing the data that’s there and not leaving spaces where the fields are empty. Hope that’s a bit clearer!! 😉

  3. Ah, I see what you mean — I thought you were talking about tabular data! Yes, with addresses in particular it is useful to skip blank lines completely rather than displaying an empty line 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *