Neil Turner's Blog

Blogging about technology and randomness since 2002

Streamlining Scrapie

As I said on Tuesday, I’m now the webmaster of Scrapie, and yesterday I got my hands on all of the passwords. Today, I got down and dirty with the source code.

The site uses a homegrown PHP CMS, which actually works quite well – it makes the documents searchable and is easy enough for less tech-savvy editors to enter articles. The site was redesigned earlier this year, and now uses a tableless design, which I guess is good.
Unfortunately, it’s a pretty bulky site – while the layout tables are gone, the spacer GIFs were not, so instead of <td>s you had a whole pile of <div>s and a huge block of inline CSS. First job was to move the scripts and CSS to external files to reduce the page bulk. Then, updating the HTML. Until today, the site was using HTML 3.2, whereas I prefer to get it up to at least XHTML 1.0 Transitional. Fortunately, this mostly consisting of changing the case of the tags and removing the odd deprecated attribute, and the updated pages now mostly validate. The errors are in a tag-on poll script, which is a rather complex multi-file PHP system, and while I’ve been able to zap a good number of the errors there’s still some encoding issues to tackle.
Then, reducing the page bulk. The spacer GIFs were replaced with, well, nothing, unless the images were a specific colour in which case I added ‘background:#000‘ (or whatever) in the stylesheet. Any more important images which were still only part of the design became CSS backgrounds.
I then altered the title of each article page so that the article name was in there, instead of just saying ‘Scrapie’ – it makes it a bit more meaningful and Google likes it more. In a similar vein, I ensured all images had suitable ALT tags and specified proper headings where appropriate – the site is now considerably more navigable in Lynx than previously, which is good.
This all took me around 4 hours, after which I gave up having only done one script, though this script does display all the articles. I moved around 12KB of extra stuff into external files, so that should make the pages faster since the stylesheet and main javascript should get cached, along with getting rid of redundant code.
Whether I’ll do any of the other pages remains to be seen, but for now I’ll stick to just entering articles :).

Comments are closed.