If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Im not sure, but it probly is a Javascript.

Hello,

I've worked with some scripts as html, css and php, but now I have something that I don't know what kind of script I have to use.

I want to load data or (rss) feed about the weather from somewhere up-to-date. If this feed says it's going to rain, i want my webpage to load several things like a text which says it's going to rain, a button with a link and some rain drops which will probly be made in a transparancy flash layer.

So i need a script which loads feed, which sees if it is going to rain or not and which can load several things when it is going to rain and leave these things if it is not going to rain.

I hope someone can give me some advice about which kind of script, like java or something else. And maybe some more specific, so i know what to look for.

This is a cool idea. There's a few things to it. Off the top of my head:

1. you need weather data;
look for your local weather bureau and find where they provide an xml feed of the weather conditions. if you are doing it for just one location (ie if your site is targeted for just one state then use that). if you want to provide the weather for where ever your user is going to come from in the country or world then you will have to be smarter. you will need to find their location by using an IP to Geolocation service, and then loading the data for that country/state.

2. save that data for the day
you dont want to have to look up the weather each time someone loads your site; so at the start of every day (or maybe 4 times a day) you should make the weather request, and then store the weather forcast in your local database, so that its much quicker for your users to load.

3. based on the weather conditions, make the changes to your templates; ie it might involve putting a body class on like "weather-rainy" and then have your style sheets over lay some rain drops and clouds etc

the way i would approach this would not use javascript; it would use a server side language (ie PHP or dotnet etc)

Thanks for your reaction, im going to work on it. You say I have to save the weather data for each day manual?
And i came with another idea when i was reading your comment. I want a function where users can search for residence or zip, does this also work with a database? Or can a simple excel sheet be used for the search function?

huh? no, you don't want to do this manually; you would find the location of the weather information data feed and then have a script that gets triggered by cron that reads new weather data once or twice a day from that data feed and saves it into your local database. once it's set up, you don't want to have to manually do anything yourself, if that's what you mean.

Originally Posted by Hyno

And i came with another idea when i was reading your comment. I want a function where users can search for residence or zip, does this also work with a database? Or can a simple excel sheet be used for the search function?
Thanks!

Absolutely; that's one of the reasons of having a database! It would be far more complicated and/or arduous to prepare a spreadsheet for them to download; you don't use excel like that on the web; stick with a database.

this isn't so complicated using javascript - you can query the yahoo weather service and use the object returned which is much simpler (and more up-to-the-minute) than saving results to a database. If you want to search for residence or zip you are probably better off geocoding that first, getting their latitude and longitude and then making the request. Here's a start, anyway (the 30341 in the query is the zip code for Atlanta - change that to get other locations)...