Re: Using PHPWeather question
Brought to you by:
iridium
From: Daisyhead <je...@da...> - 2004-02-11 03:32:19
|
Okay, so what if I just want a simple list of certain things? This is the code I have, but the only things pulling info are the temp, wind and humidity fields. Can I do something like below and still have it pull all the info I want? <?php require('/home/xxx/public_html/weather/phpweather.php'); $weather = new phpweather(); $weather->set_icao("KOMA"); $foo = $weather->decode_metar(); $temp_c = $foo['temperature']['temp_c']; $temp_f = $foo['temperature']['temp_f']; $miles_per_hour = $foo['wind']['miles_per_hour']; $dew_point = $foo['dew-point']['dew_point']; $visibility_less_than = $foo['visibility']['visibility_less_than']; $feelslike = $foo['feelslike']['feelslike']; $weather = $foo['weather']['weather']; $rel_humidity = $foo['rel_humidity']['rel_humidity']; $altimeter = $foo['altimeter']['altimeter']; echo "Temp: $temp_f ° Fahrenheit<br>"; echo "Feels like: $feelslike<br>"; echo "Conditions: $weather<br>"; echo "Wind: $miles_per_hour MPH<br>"; echo "Humidity: $rel_humidity %<br>"; echo "Dewpoint: $dew_point<br>"; echo "Pressure: $altimeter<br>"; echo "Visibility: $visibility_less_than"; ?> Thanks, Jenni ----- Original Message ----- From: "Max Hammond" <ma...@fl...> To: "Daisyhead" <je...@da...>; <php...@li...> Sent: Tuesday, February 10, 2004 2:26 AM Subject: RE: Using PHPWeather question > > > > Is > > there any way to use a "shortcut" and call in all the variables? > > sure... this is the way that PHPweather was really designed to be used. > > <?php > > // first of all, set up the decoder > require('phpweather.php'); > $weather = new phpweather(); > $weather->set_icao("KOMA"); > > // next, the text parsing > require('output/pw_text_en.php'); > $text = new pw_text_en($weather); > echo $text->print_pretty(); > > echo '<br />'; > > // now, images > require('output/pw_images.php'); > $icons = new pw_images($weather); > echo '<img src="' . $icons->get_sky_image() . > '" height="50" width="80" border="1" alt="Current weather in ' . > $weather->get_location() . '" /> ' . > '<img src="' . $icons->get_winddir_image() . > '" height="40" width="40" border="1" alt="Current wind in ' . > $weather->get_location() . '" /> ' . > '<img src="' . $icons->get_temp_image() .' />'; > > > ?> > > Cheers, > > Max > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > PHPWeather-devel mailing list > PHP...@li... > https://lists.sourceforge.net/lists/listinfo/phpweather-devel > > |