sas the investigative hedgehog (theaeblackthorn) wrote in lj_nifty,
sas the investigative hedgehog

PHP Weather Layout Changer

Hi all!

I'd seen the rotating header image code before and it got me thinking what else you could do with a nice bit of php and livejournal.

So, I've made a PHP page that returns a different CSS depending on the weather in your current area!

It uses a Yahoo weather feed to figure out the current weather and picks from a list of stylesheets you can provide it with.

Well, I thought I'd share it with everyone!

instructions and code at my journal

I'm happy to answer any questions.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

(Jokingly) Dare we trust someone who can't close his quotes?
Dare we trust someone who assumes genders? *laughs*
There's maybe a language barrier involved, but I didn't spot any gender assumptions in there. The choosing of if statements over switch or associative array still made me smile though.

THAT SAID, I think that this idea is neat enough not to care about implementation details like that. I believe in the good intent of the post author, and I wouldn't want him/her to be disappointed by picking in comments like this.
I was being self-deprecating on the second. See my choice of "he", then have a look at the OP's journal.
Ah, got it now. Thanks for clarifying! :D
It's what we get for breaking our keyboard and resorting to our backup one. Fear not, the code was typed up before!

And more importantly, it's currently running my lj's layout. :)
*nods* definately very nice work :) I have no host to run it myself, but from a quick look I was quite impressed :)
A friend kindly let me host it on hers, I'll agree my execution may not be the most elegant, but it spooks people who visit my lj well enough, so I'm happy :)
Actually I disagree. I could sight read it, and I don't do php. It's commented enough to grok the ideas of the routine, and it's instantly sight readable. Two very key features in good code. Means that later maintenance is easy and achievable, and that's something that you learn from experience is a really really really good thing :) Smart's no good if you can't understand it in 6 mths time.
Indeed, good documentation is vital for later code maintenance. The amount of times recently I've had bugs for areas and found the code to just be unreadable is ridiculous.

Generally I work with Java, not PHP hence my PHP isn't the best, it's more a hobby than a job :)
Fun idea!
That's nicely done! I've been using something kind of like that on my journal for a couple years now to print the current temperature in my journal sidebar (like so: ) but extending it all the way out to the layout CSS is a neat trick and one I hadn't thought of.

The only quibble I'd have is using a switch statement in place of the if statements, but you've explained your reasons for using them elsewhere and that's a personal preference anyway. ;-) Very cool!
I just open the curtains :)
I can't open your curtains. :)

Therefore, using the OP as an example, I can "look out her curtains" by visiting her journal. :)