Re: PHP Weather 2.1.2
Brought to you by:
iridium
From: Pedro L. <li...@le...> - 2003-05-12 15:00:44
|
Hey Guys, I'm actually using PHPWeather 1.62 at http://www.stpatrickhighschool.org/we= ather, you can see it intergrated into PostNuke at http://www.stpatrickhighschool.= org. I still have to change the background colors on the sky images. I was trying to do the same with version 2.1.2, but I couldn't get it working right, I'm= not good with php. I've just gotten around to reading my mailing lists and Mart= in sent me a write up on version 2.1.2, so I'll give that a try. If you want to do something similar to what I have done, the html code is at the bottom. I'm really sorry for being lazy and not putting line breaks on the code, bu= t that's the actual index.php that I run from a cron which directs it's output to a = flat html file which I then include in the PostNuke page. I did this because for= some reason the straight php file wouldn't display right and if the flat html pa= ge had any line breaks in it, it would display those as line breaks in the html ma= king it very ugly... it's retarted, I know, but I got it working that way :) If I get version 2.1.2 to work the same way, then I'll send the html code f= or that. Take this into an editor and insert line breaks, this is using version 1.62= and=20 a flat cache page. <html><head><style type=3D"text/css">("/themes/PostNuke/style/style.css"); = </style></head><body><?php include('/home/www/stpatrickhighschool/htdocs/we= ather/images.inc'); include('/home/www/stpatrickhighschool/htdocs/weather/l= ocale_en.inc'); include('/home/www/stpatrickhighschool/htdocs/weather/phpwe= ather.inc'); $metar =3D get_metar('KEWR'); $decoded_metar =3D process_metar= ($metar); $data =3D process_metar($metar); $temp =3D $data['temp_f']; $minu= tes_old =3D round((time() - $data['time'])/60); ?> <table width=3D"190" bor= der=3D"0" cellspacing=3D"0" cellpadding=3D"0"> <tr> <td><div align=3D"cente= r"><font size=3D"2"><strong>Elizabeth, New Jersey</strong></font></div></td= > </tr> <tr> <td><table width=3D"100%" border=3D"0" align=3D"center" cellpa= dding=3D"0" cellspacing=3D"0"> <tr> <td width=3D"44%" height=3D"40" rowspan= =3D"4" align=3D"center" valign=3D"top"> <br> <img src=3D"/weather/<?php get= _sky_image($decoded_metar) ?>" height=3D"45" width=3D"75" border=3D"0" alt= =3D"Current Sky"><br><?php echo "$data[cloud_layer1_condition]";?> </td> <t= d width=3D"10%" rowspan=3D"4"> </td> <td width=3D"31%" height=3D"19" a= lign=3D"right" valign=3D"bottom"> </td> <td width=3D"15%" valign=3D"m= iddle"> </td> </tr> <tr> <td height=3D"1" align=3D"right" valign=3D"mi= ddle"><font size=3D"5"><strong><?php echo "$temp°F"; ?></strong></font>= </td> <td width=3D"15%" rowspan=3D"3" align=3D"right" valign=3D"top"><img = src=3D"/weather/<?php get_temp_image($decoded_metar) ?>" height=3D"50" widt= h=3D"20" border=3D"0" alt=3D"Current Temperature"></td> </tr> <tr> <td alig= n=3D"right" valign=3D"bottom"><strong><font size=3D"2"><?php echo "$data[te= mp_c]°C";?></font></strong></td> </tr> <tr> <td align=3D"right" valign= =3D"top"><font size=3D"4"><strong> </strong></font></td> </tr> </table= ></td> </tr> <tr> <td><div align=3D"center"></div></td> </tr> <tr> <td alig= n=3D"center" valign=3D"top"><br> <table width=3D"100%" height=3D"130" borde= r=3D"0" align=3D"center" cellpadding=3D"0" cellspacing=3D"0"> <tr> <td widt= h=3D"64" height=3D"20" align=3D"left" valign=3D"top"><font size=3D"2"> = ;Humidity:</font></td> <td width=3D"10" height=3D"20" align=3D"left" valign= =3D"top"> </td> <td width=3D"109" align=3D"left" valign=3D"top"><font = size=3D"2"><?php echo "$data[rel_humidity]%";?></font></td> </tr> <tr> <td = align=3D"left" valign=3D"top"><font size=3D"2"> Wind:</font></td> <td = height=3D"28" align=3D"left" valign=3D"top"> </td> <td height=3D"28" a= lign=3D"left" valign=3D"top"><font size=3D"2"><?php echo "From the $data[wi= nd_dir_text] at $data[wind_miles_per_hour] mph";?></font></td> </tr> <tr> <= td align=3D"left" valign=3D"top"><font size=3D"2"> Windchill:</font></= td> <td height=3D"20" align=3D"left" valign=3D"top"> </td> <td height= =3D"20" align=3D"left" valign=3D"top"><font size=3D"2"><?php echo "$data[wi= ndchill_f]°F";?></font></td> </tr> <tr align=3D"center" valign=3D"middl= e"> <td align=3D"left" valign=3D"top"><font size=3D"2"> Pressure:</fon= t></td> <td height=3D"20" align=3D"left" valign=3D"top"> </td> <td hei= ght=3D"20" align=3D"left" valign=3D"top"><font size=3D"2"><?php echo "$data= [altimeter_inhg] inches";?></font></td> </tr> <tr align=3D"center" valign= =3D"middle"> <td height=3D"20" align=3D"left" valign=3D"top"><font size=3D"= 2"> Visibility:</font></td> <td height=3D"20" align=3D"left" valign=3D= "top"> </td> <td height=3D"20" align=3D"left" valign=3D"top"><font siz= e=3D"2"><?php echo "$data[visibility_miles] miles";?></font></td> </tr> <tr= align=3D"center" valign=3D"middle"> <td height=3D"22" colspan=3D"4"><font = size=3D"1">As of </font><font size=3D"1"><?php echo "$minutes_old";?> minut= es ago</font></td> </tr> </table></td> </tr> </table></body></html> Here's the cache file; /tmp/weather-cache.xml <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <metardata> <cache station=3D"KEWR" metar=3D"KEWR 121351Z 14005KT 1SM HZ OVC009= 16/13 A2956 RMK AO2 SFC VIS 5 CIG 008V015 SLP008 T01610133" timestamp=3D"1= 052747460" /> </metardata> -Pedro On Thu, May 08, 2003 at 09:52:38PM +0200, Martin Geisler wrote: > Dan Martin <da...@da...> writes: >=20 > Hi Dan >=20 > > I initially tried utilizing PHP Weather 2.1.2 and I can get things > > to work. >=20 > Good, that's always nice to hear! :-) >=20 > > But I do not like the format of pretty print. I want a format > > similar to what Pedro Leitao has at > > http://www.stpatrickhighschool.org/weather/ , but I cannot seem to > > pull the variables needed to do so. >=20 > Perhaps we can persuade Pedro to reveal his nifty code? :-) I would be > very happy to include it as a second choice of output method for > PhpWeather. Infact, this is just the kind of output that PhpWeather > needs, I've never gotten around to making a proper tabular output. >=20 > > I am using 1.62, however it only work some of the time. Most of the > > time it cannot pull the data. Would it be better to pull it into > > MySQL using a hourly crontab, and query from there? >=20 > There shouldn't be any difference --- PhpWeather is basically doing > just that, or rather it's supposed to be doing that. >=20 > > As you can probably tell I am not too proficient at PHP. > > > > I would appreciate any help. >=20 > We'll see what we can do. >=20 > --=20 > Martin Geisler My GnuPG Key: 0xF7F6B57B >=20 > See http://gimpster.com/ and http://phpweather.net/ for: > PHP Weather: Shows the current weather on your webpage and > PHP Shell: A telnet-connection (almost :-) in a PHP page. > Join Freenet: http://gimpster.com/downloads/freenet/ >=20 >=20 > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise solutions > www.enterpriselinuxforum.com >=20 > _______________________________________________ > PHPWeather-devel mailing list > PHP...@li... > https://lists.sourceforge.net/lists/listinfo/phpweather-devel |