Someone with too much of a memory might remember me talking about the problems with my CSS files being served up as text/plain instead of text/css, and Mozilla Firefox barfing them because of it.
Well I still haven't found out what's up with it all, and the problem is still happening with the latest version of Firefox so I finally gave in and knocked together the following bit of PHP.
<?php header('Content-Type: text/css; charset=iso-8859-1'); $lastmod = gmdate('D, d M Y H:i:s', getlastmod()); header('Last-Modified:'.$lastmod.' GMT'); ?>
A quick addition of a .htaccess file in the directory which holds the CSS file, with the line
AddType application/x-httpd-php .css
And we're away. The CSS files are now parsed by PHP and the correct mime type set. To try and help web browsers cache it, the last two lines check when the CSS file was modified and set the HTTP Last-Modified header appropriately.
It could be added to to send a 304 Document Not Modified header instead but this is the first bit of PHP I've ever written so I think I'll leave it there for now.
It's all implemented on this site and it appears to all work fine - let me know if you're viewing the site and everything isn't nice and pretty. Once I'm happy it all works, I'll spread the PHP fix to other affected sites.
Email Form Woe
Which neatly leads me onto another problem. I discovered on Wednesday that the email forms on The F-Word, Planet Bods, The Tyne Tees Logo Page and this site were broken and not sending emails. Even worse, it's been a problem since the beginning of July. We just hadn't noticed.
Ironically Catherine had thought things were a bit quiet but blamed it on summer. Goodness knows how many emails have gone off into the ether never to be seen again. Believe me, it's rather frustrating.
The problem was a configuration problem on the webserver. The Hitoplive notify plugin couldn't find Sendmail and was barfing. Unfortunately there's no error tracking in Notify so everything just looked normal.
All of which is a bit of a twat which is why my next PHP task will be to re-write all the email forms to use PHP instead of Notify - Notify is a bit of a hack and isn't really up to production standard (as its author admits). I'd rather push it through PHP and get some error handling in there - just in case something breaks again.
My PHP is very basic at the moment, but I've been looking through some tutorials and the above script wasn't particularly hard to write. It all seems pretty straightforward and simple - presumably why people use it so much.
I have been thinking of learning PHP for some time - I last properly considered it about 18 months ago when I was thinking about leaving the BBC for something different. PHP is quite a popular requirement for a developer these days. As it was, I decided to stay and moved into production instead, but it would be good to know some PHP just in case I ever go back into coding again.
And it's been quite good fun learning something new for a change - it's given me the kind of enthusiastic glow again that I had when I first learnt HTML, then CSS, then CSS layouts and so on. It's good to broaden your horizons a little once every now and then.
Whether I move any sites over from Hitoplive to PHP - well I don't know yet. That will just have to wait and see!
UPDATE: alas the fix stopped working, but there's a better one that works. Plus it's really simple. See the update from August 2005 for more details.