pxlcreations
01-25-2011, 09:35 PM
Hey all, I have a question about this script I am using to display weather on my site through yahoo rss. This is the script that pulls it all in:
<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/web-programming/ajax/show-yahoo-weather.html
*/
error_reporting (E_ALL ^ E_NOTICE);
if(isSet($_GET['p'])) // at least 'p' is required
{
$p = $_GET['p'];
$u = isSet($_GET['u']) ? $_GET['u'] : '';
require('magpierss/rss_fetch.inc');
$url = 'http://xml.weather.yahoo.com/forecastrss/'.$p.'&u='.$u. '.xml';
$rss = fetch_rss($url);
$title = $rss->items[0]['title'];
$description = $rss->items[0]['description'];
echo "<br />".$title."<br /><br />".$description."<br />";
}
?>
It then displays the information as this:
Conditions for Buffalo, NY at 3:56 pm EST
[WEATHER IMAGE]
Current Conditions:
Light Snow, 30 F
Forecast:
Tue - Few Snow Showers. High: 32 Low: 20
Wed - Mostly Cloudy. High: 27 Low: 21
Thu - Few Snow Showers. High: 24 Low: 19
Fri - Snow Showers. High: 25 Low: 20
Sat - Snow Showers. High: 29 Low: 20
Would there be any way to display the Tue - Few Snow Showers. High: 32 Low: 20 in a div? Like <div class="future">Tue - Few Snow Showers. High: 32 Low: 20</div>? Let me know if this can be done, thank you.
<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/web-programming/ajax/show-yahoo-weather.html
*/
error_reporting (E_ALL ^ E_NOTICE);
if(isSet($_GET['p'])) // at least 'p' is required
{
$p = $_GET['p'];
$u = isSet($_GET['u']) ? $_GET['u'] : '';
require('magpierss/rss_fetch.inc');
$url = 'http://xml.weather.yahoo.com/forecastrss/'.$p.'&u='.$u. '.xml';
$rss = fetch_rss($url);
$title = $rss->items[0]['title'];
$description = $rss->items[0]['description'];
echo "<br />".$title."<br /><br />".$description."<br />";
}
?>
It then displays the information as this:
Conditions for Buffalo, NY at 3:56 pm EST
[WEATHER IMAGE]
Current Conditions:
Light Snow, 30 F
Forecast:
Tue - Few Snow Showers. High: 32 Low: 20
Wed - Mostly Cloudy. High: 27 Low: 21
Thu - Few Snow Showers. High: 24 Low: 19
Fri - Snow Showers. High: 25 Low: 20
Sat - Snow Showers. High: 29 Low: 20
Would there be any way to display the Tue - Few Snow Showers. High: 32 Low: 20 in a div? Like <div class="future">Tue - Few Snow Showers. High: 32 Low: 20</div>? Let me know if this can be done, thank you.