Hi all,
A user on my forums suggested I put in a slice of DHTML code that simulates snow due to the weather this morning. Quite cute, if not original. I then got to thinking: instead of me editing my header code every time it snows/stops snowing, how about automating it?
I found the BBC supplies an RSS feed with an hourly observation. The one for here in Cardiff is : http://newsrss.bbc.co.uk/weather/forecast/4/ObservationsRSS.xml . The snow has stopped here now, but I’m presuming that the title tag will contain the word ‘snow’ when appropriate.
Now, using PHPs simplexml function, it should be fairly trivial to put a few lines of code in that check this feed, and enable the javascript if it finds the chosen keyword.
However, with usually 60+ people on my site during normal hours, I’m pretty sure the BBC would get tired of their feed getting hit everytime someone clicks a link. I’m trying to think of a way of doing a single check once per hour, and then using the locally retrieved data to determine whether to trigger. Has anyone got a nice way of doing that that won’t slow down the site for the enduser?
(Not even sure if I can execute PHP in the headers of Invision, the forum software I use, but I’m sure there’ll be a way of hacking it in somehow!)