...

View Full Version : Weather module for my website!



ngohuynhnguyen
08-23-2007, 08:13 PM
Hello!
I'm Huynh Nguyen. I'm very interested in http://www.oliverhine.com/ weather module, but unfortunately it's just for the Dot Net Nuke system and further more for ASP (IIS server) technology. However I'm now using PHP in an apache server to run my website. So could you help me with this problem? I love http://www.oliverhine.com/ weather module so much I really want to get it in to my PHP website. Please help me to convert it or something like that.
Waiting for your reply in hopefully!
Best Regards,
Huynh Nguyen

StupidRalph
08-23-2007, 08:36 PM
You should try a search on this forum b/c there are a few threads out there which cover this topic. I know of one specifically:
http://www.codingforums.com/showthread.php?t=79468

mlseim
08-23-2007, 08:57 PM
What is your city ... I'll check it and see if the deal I have works good.

And you want to create your very own customized feed or use this?
http://www.weather.com/services/oap.html?from=rss_index&refer=rss_index

ngohuynhnguyen
08-24-2007, 03:26 AM
Well, I've try to do some searching. However what I've shown on the demo URL is different from all. I also know that this module get the data from the website weather.com. There's a simple way available on that website (weather.com) to let using add the weather bug in their website, however, with the source (script) given by weather.com, there a lot of thing do not necessary, such as ads, weather.com logo, etc..
As you can see from the demo URL I've just given above, the weather bug box just inclue the images, some information. Yes, it's really nice and of course, do not have any ads at all. That's all I need.

My city is Ho Chi Minh City, Viet Nam

Again, someone could help me please, thank you so much!

mlseim
08-24-2007, 02:19 PM
Now you have to decide how much info you want to have ...

In this example (using weather underground), it grabs the
basics for current weather and a couple of more days forecast.

You can parse-out anything you need (customize the data).
Using a split on pipes | , you can parse out the details for
the current weather, then display them anyway you want.

Here's my basic working example:
http://www.catpin.com/vietnam

Here is the PHP script:


<?php

echo"
<style>
#rss{
margin: 0px auto;
font-family: arial;
font-size: 8pt;
color: #222;
width: 200px;
padding: 5px 10px 5px 0px;
border: 1px solid #555;
text-align: left;
}
</style>
";
include "./lastRSS.php";
$rss = new lastRSS;
$count=1;
if ($rs = $rss->get('http://www.wunderground.com/auto/rss_full/global/stations/48900.xml?units=both')) {
echo "<div id='rss'><ul>\n";
foreach($rs['items'] as $item) {
if($count<=5){
list ($ione, $itwo, $ithree) = split ('-', $item['title']);
list ($one, $two, $three) = split ('-', $item['description']);
echo "$ione<br>$one <br>$itwo<br> $two <br> $three <br> ";
}
$count=$count+1;
}
echo "</ul></div>\n";
}
else {
echo "Error: It's not possible to reach RSS file...\n";
}
?>


And attached is the required file: lastRSS.php

I attached as a .txt file ... change the extension to .php

mlseim
08-24-2007, 04:09 PM
Here's an example of what I mean by parsing out the current details and
using some graphic images to determine what the conditions are. You of
course might have some different condition graphics you'll need.

My working "live" example:
http://www.catpin.com/weather/vietnam.php

Here's the PHP script for that:


<?php

echo"
<style>
#rss{
margin: 0px auto;
font-family: arial;
font-size: 8pt;
color: #222;
width: 225px;
height: 60px;
padding: 0px 0px 0px 0px;
border: 1px solid #555;
text-align: left;
}
</style>
";
include "./lastRSS.php";
$rss = new lastRSS;
$count=1;
if ($rs = $rss->get('http://www.wunderground.com/auto/rss_full/global/stations/48900.xml?units=both')) {
$city="Ho Chi Minh City";
echo "<div id='rss'>\n";
foreach($rs['items'] as $item) {
if($count<=1){
list ($one, $two, $three) = split ('-', $item['description']);
list ($temp, $humidity, $test, $conditions) = split ('\|', $one);
$con="pixel.gif";
if(strstr($conditions, 'vercast')){$con="overcast.gif";}
if(strstr($conditions, 'ain')){$con="rain.gif";}
if(strstr($conditions, 'og')){$con="fog.gif";}
if(strstr($conditions, 'now')){$con="snow.gif";}
if(strstr($conditions, 'loudy')){$con="cloudy.gif";}
if(strstr($conditions, 'unny')){$con="sunny.gif";}
if(strstr($conditions, 'lear')){$con="sunny.gif";}
if((strstr($conditions, 'unny'))&&(strstr($conditions, 'artly'))){$con="partly.sunny.gif";}
if((strstr($conditions, 'loudy'))&&(strstr($conditions, 'artly'))){$con="partly.cloudy.gif";}
if((strstr($conditions, 'loudy'))&&(strstr($conditions, 'ostly'))){$con="mostly.cloudy.gif";}
if((strstr($conditions, 'louds'))&&(strstr($conditions, 'catter'))){$con="partly.cloudy.gif";}
echo "
<img src='$con' width='50' height='40' alt='$con' title='$con' border='0' style='float: left; padding: 0px 5px 0px 0px;' />
<b>$city</b><br>$temp<br>$humidity<br>&nbsp;&nbsp;$conditions
";

}
$count=$count+1;
}
echo "</div>\n";
}
else {
echo "Error: It's not possible to reach RSS file...\n";
}
?>

ngohuynhnguyen
08-24-2007, 04:53 PM
wow, I cannot say how much thank you I have to say with you, thank you so much. And just more last more things, can I change the language using in your demo, such as Vietnamese. If yes, it perfect!

mlseim
08-24-2007, 05:14 PM
You have the script right there ... do whatever you want with it.

Also make sure you get "lastRSS.txt" file (see attached file in previous post),
then change extension to .php

I assume you have some character set that is Vietnamese instead of English?
I'm not sure how that works, but the characters are a function of the
content type ... nothing to really do with the script itself.

You would have to convert the English words that come from the XML
from English to Vietnamese ... that part I'm not sure how to do.

jmemac
07-05-2011, 12:30 PM
Hello i have some questions id like to ask about developing my website but am unsure where to post them, i know you have specific forums for things such as java script ect but what if your unsure what forum to post in could you not have a forum for such questions where the person requiring knoledge can post questions?.

for explanation the questions i have regard a weather module for my site, i have surched this on your site and many others but cannot find a modle detailed enough, user friendly enough or accurate enough for my requirements.

i require a modle that is graphically pleasing animated and can collect data from various sources mainly weather bouys to show sea swell, wave power also i need wind speed and direction and water temp.

something such as the animated charts on www.magicseaweed.com would be amazing.

i have been searching to try and source such a thing for a few months now and am getting no where. so if you could help me post this request in the correct place and even help me find the answer i would be eternally gratefull.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum