Thatgeek – Previously Sonicpling

Friday February 20, 2004

Weather Hack

Filed under: General — Jeremiah @ 7:15 pm

I’ve added a local weather doo-dad, in the sidebar. I think it’s nifty.
You can view it with all options enabled here, and you can get the source and instructions to add to your own Wordpress site here.

let me know if you’re using it, or if you have any questions or problems here or in the comments.

Update: I’ve changed the link to point to a new file updated to be a plugin for wordpress 1.2 and up!
get it while the getting is good!

Update2: if you want just the weather.php file (without the language strings and icons) you can get it here.

Update3: if you want to change the language, you can edit the “language.php” file. here are some: contributed translations.

150 Responses to “Weather Hack”

  1. Connie Says:

    Hi Jeremiah, I am currently (still) running b2 on my site, but have a Wp test log, and am trying your weather hack there, I really like it, it´s brilliant! :-D Because I am not yet ready to convert to wp (too many hacks and entries to convert), I was wondering if there is any way to use the hack on a none wp site. Thank you in advance for a possible reply! :-D

  2. Connie Says:

    Oh I figured it out, thank you! :-D

  3. Jeremiah Says:

    Connie,
    Saw your first comment too late to even try helping.. lol

    Glad you got it working!

    –Jeremiah

  4. Luigi Says:

    Dear Jeremiah, i tried your script.
    But when i include in my-hacks.php this line:
    include_once(’weather/weather.php’);

    it shows the weather conditions on the home page even if i have not included the line:
    < ?php show_wp_weather(); ?>
    in my index.php
    And, most of all it completely destroy the GUI.
    What’s the prob ?

  5. Crystal Says:

    that’s pretty cool!

  6. Ulothrix Says:

    Outstanding software! Installed it within a breeze.

  7. Eduardo Says:

    Hi, i am testing your hack locally, very nice. Can one display the weather for more than one station?

  8. litlnemo Says:

    Hmm. weather.noaa.gov seems to be completely hosed at the moment. So I can’t tell if the weather script is working for me or not. :(

  9. Jeremiah Says:

    Eduardo,

    Glad you like it!
    The easiest way to display more than one station right now is just to
    use more than one copy of the file.
    TechGnome was saying that he might setup the station ID so that it could
    be passed to the function.

    You might check the wordpress forum and see if he’s done that..

    I’ve been too busy of late to do anything more with it..
    –Jeremiah

  10. litlnemo Says:

    weather.noaa.gov came back up and when it did, I saw that the weather script IS working for me. :) Thanks!

  11. Eduardo Says:

    Thanks, Jeremiah!

  12. denise Says:

    Love it! Put it on one of the sites I maintain today, located at htttp://www.taeq.us/journal/. This was just what I was looking for! Awesome work! :)

  13. k-log (by Kinkamono Internet Services) Says:

    […] he menu column you’ll see a new addition — a weather add-on for WordPress from Jeremiah. I implemented it without any problem, and had a look at the results in my b […]

  14. k-log (by Kinkamono Internet Services) Says:

    […] he menu column you’ll see a new addition — a weather add-on for WordPress from Jeremiah. I implemented it without any problem, and had a look at the results in my b […]

  15. Monkey Says:

    Does it go out and fetch the file every time, or does it cache it somewhere to reduce traffic?

  16. Jeremiah Says:

    Monkey,
    it fetches the file every time. it’s a very small file though.

    Looks like this:
    “2004/03/18 02:55
    KLUF 180255Z 23005KT 20SM SKC 26/M03 A2983 RMK SLP087 WND DATA ESTMD 53003″

    You can see the actual file that it fetches like this:
    http://weather.noaa.gov/pub/data/observations/metar/stations/KLUF.TXT

    (replace “KLUF” with whatever your station code is)

  17. slurdge Says:

    I implemented simple caching.
    Maybe this would interrest someone …
    Here is the modified get_metar function:

    function get_metar($station, &$wxInfo) {

    //Add cache to speed up querying
    $metar = false;
    $process_request = false;
    $info = false;
    @$info = file('weather.txt');
    if ($info)
    {
    if ( ( time() - $info[0] ) > 3600 ) //More than one hour ?
    $process_request = true;
    else
    {
    //echo "cached";
    $metar = $info[1];
    }
    }
    else
    {
    $process_request = true;
    }
    if ($process_request)
    {
    //echo "process";
    $host = 'weather.noaa.gov';
    $location = "/pub/data/observations/metar/stations/$station.TXT";
    $request = "HTTP/1.1\r\n" .
    "If-Modified-Since: Sat, 29 Oct 1994 09:00:00 GMT\r\n" .
    "Pragma: no-cache\r\n".
    "Cache-Control: no-cache\r\n";
    @$fp = fsockopen($host, 80);
    $request = "GET $location $request" .
    "Host: $host\r\n" .
    "Content-Type: text/html\r\n" .
    "Connection: Close\r\n\r\n";
    if ($fp) {
    fputs($fp, $request);
    if (strpos(fgets($fp, 1024), '200 ')) {
    do {
    $line = fgets($fp, 1024);
    } while ($line != "\r\n");
    while ($line = fgets($fp, 1024)) {
    $metar = $line;
    }
    fclose($fp);
    @$fptxt = fopen('weather.txt','w');
    if ($fptxt)
    {
    fwrite($fptxt,time()."\n");
    fwrite($fptxt,$metar);
    fclose($fptxt);
    }
    }
    }
    }
    return $metar;
    }

  18. Jeremiah Says:

    Thanks Slurdge!

  19. Visual Grammar » Just Up Says:

    […] ed features: Kitty’s Spam Words plugin Spammers, you have been forewarned! Weather Outlook by Mambo, converted for Wordpress by Jeremiah, improved by TechGnome […]

  20. madbros Says:

    nice! works in php-nuke too, with little modifications !! ;)

  21. neil Says:

    Hi,
    I have installed your great plugin. Is there an easy way to get a white background to the icon. My site is a light colour and I feel a lighter background to the icon would work better for me.
    Thanks
    Neil

  22. Jeremiah Says:

    neil,
    Actually, the icons have a transparent background.
    Internet explorer just doesn’t handle them correctly.
    firefox, mozilla, opera, and safari all handle the icons correctly.

    Look here for a fix:
    http://homepage.ntlworld.com/bobosola/index.htm

    or check out the “instructions.txt”" file thats included with the plugin.
    it has the info you need to use the gif images instead of the png’s if you want to.

    –Jeremiah

  23. neil Says:

    Thanks for the fast response Jeremiah-I see that in firefox I have the desired effect ! I will check out your instructions further.
    One more question…..I am in Luxembourg and my hosting company is Total Coice Hosting USA-I have my server differential time set to +6 hours-is this correct? I don’t think I am in phase with that setting?
    Any help would of course be much appreciated

    Neil

    http://www.cyber6.org

  24. Marius Ooms Says:

    Thanks Jeremiah for making a geat plugin. I left a reference of your site in my last post. By the way, I found it the easiest to just make the .png’s into .jpg’s with corresponding color backgrounds. That also cut the size down about 600%. Let me know what you think of my implementation.

    http://www.oomonline.com

  25. Marius Ooms Says:

    Sorry…I provided a dead link. I hate typos. Ps don’t mean to advertise, just like to get your opinion =)

    http://www.oomsonline.com

  26. Gabe Says:

    I got it up and running on my site. Thanks for making this plugin! My blog is a work in progress, feel free to join.

    http://sewaren.no-ip.com:24/blogs/netverkin

    -Gabe

  27. zuppah » wordpress e il tempo Says:

    […] […]

  28. whld Says:

    Thank you oh great prog for your time and effort to make this program plugin.And thanks for sharing.Thanks Again

    Wih reg
    whld

  29. paul Says:

    First, this is a great plugin… good job. But I am having a slight problem that I can’t seem to resolve. I was hoping you could help. The plugin appears to be working fine (it does show the weather), with exception to one error… it can’t seem to find the cache file. I get a no such directory error. I’ve created the “weather_cache” folder and set the permissions, but it still can’t find it. Any ideas? Thanks.

  30. paul Says:

    Never mind… I found the answer I needed on the wordpress forum… Thanks for the GREAT plugin! :)

  31. jesstech Says:

    Hmm, my problem as well. Gotta love it when people follow up with a ‘resolved’ comment but conviently forget to include a link to the answer they found.

  32. paul Says:

    I can’t find the specific post on wordpress that lead me to the answer, but basically the problem was solved by editing line 53 of ‘weather.php’ to be the real path to my ‘weather_cache’ folder. Of course adding the ‘weather_cache’ folder to the plugins folder is also important. I didn’t see that mentioned in the documentation. Another problem may have been the weather service text files. For San Francisco SFO (KSFO) seems to work better than the other one.

  33. Andrew Krespanis Says:

    I really like this plugin, but I really don’t like the html used to output it…
    Rather than just whinge about it, I’ve made some improvements myself.
    All ul’s/li’s are GONE. Location now appears as an h3, image is no longer nested inside anything else. All weather information is presented using the most semantically correct element for this case: a definition list. eg: Temperature is a

    and the temperature reading is its All xhtml is now output with line breaks, so it results in much neater code :)

    I'm only posting the section I've changed, but replacing this section of weather.php should be simple.

    $weather =""; //This is the variable used to store the weather output.

    $wxInfo['STATION'] = $station;
    $wxInfo['TEMPERATURE'] = $temperature;
    $wxInfo['CACHE_TIMEOUT'] = $cache_timeout;
    $wxInfo['CACHE_DEBUG'] = $cache_debug;
    $wxInfo['CACHE_PATH'] = $cache_path;
    $metar = get_metar($station,$wxInfo);

    process_metar($metar,$wxInfo,$visibility_unit,$wind_unit);

    if ($metar==''||$metar==false||$metar==null||($wxInfo['TEMP_C']==''&&$wxInfo['TEMP_F']==''))
    {
    $weather = $weather . '

    ‘. $location. “

    “._NOTAVAILABLE. “

    “;
    }
    else
    {
    $weather = $weather . ‘

    ‘. “$location

    \n”;

    // icon
    $no_night=0;
    $now=gmdate( “H”, time()+$local_time*60*60 );

    //Debug The Time
    if ($wxInfo[’CACHE_DEBUG’]) {echo “

  34. Hour: “.$now.”
  35. “;}
    // fog
    if ($wxInfo[’CONDITIONS_STATUS’]==’8′)
    {
    $wxInfo[’ICON’]=”1cloud_fog$icon_extension”;
    $no_night=1;
    }

    // heavy snow
    if ($wxInfo[’CONDITIONS_STATUS’]==’5′ && $wxInfo[’CONDITIONS_SEVERITY’]==’2′)
    {
    $wxInfo[’ICON’]=”4cloud_heavysnow$icon_extension”;
    $no_night=1;
    }
    // light snow
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’5′ && $wxInfo[’CONDITIONS_SEVERITY’]==’1′)
    {
    $wxInfo[’ICON’]=”4cloud_modsnow$icon_extension”;
    $no_night=1;
    }
    // snow
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’5′ && $wxInfo[’CONDITIONS_SEVERITY’]==’0′)
    {
    $wxInfo[’ICON’]=”4cloud_lightsnow$icon_extension”;
    $no_night=1;
    }
    // general snow
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’5′)
    {
    $wxInfo[’ICON’]=”4cloud_lightsnow$icon_extension”;
    $no_night=1;
    }
    // heavy rain
    if ($wxInfo[’CONDITIONS_STATUS’]==’4′ && $wxInfo[’CONDITIONS_SEVERITY’]==’2′)
    {
    $wxInfo[’ICON’]=”4cloud_heavyrain$icon_extension”;
    $no_night=1;
    }
    // light rain
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’4′ && $wxInfo[’CONDITIONS_SEVERITY’]==’0′)
    {
    $wxInfo[’ICON’]=”4cloud_lightrain$icon_extension”;
    $no_night=1;
    }
    // rain
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’4′ && $wxInfo[’CONDITIONS_SEVERITY’]==’1′)
    {
    $wxInfo[’ICON’]=”4cloud_modrain$icon_extension”;
    $no_night=1;
    }
    // thunder
    elseif ($wxInfo[’CONDITIONS_STATUS’]==’2′)
    {
    $wxInfo[’ICON’]=”3cloud_thunders$icon_extension”;
    $no_night=0;
    }
    // scattered clouds
    elseif ($wxInfo[’CONDITIONS_STATUS’]==” && ($wxInfo[’CONDITIONS_SEVERITY’]==” || $wxInfo[’CONDITIONS_SEVERITY’]==’0′) && $wxInfo[’CLOUDS_STATUS’]==’2′)
    {
    $wxInfo[’ICON’]=”2cloud_norain$icon_extension”;
    $no_night=0;
    }
    // mostly cloudy
    elseif ($wxInfo[’CONDITIONS_STATUS’]==” && ($wxInfo[’CONDITIONS_SEVERITY’]==” || $wxInfo[’CONDITIONS_SEVERITY’]==’0′) && $wxInfo[’CLOUDS_STATUS’]==’3′)
    {
    $wxInfo[’ICON’]=”3cloud_norain$icon_extension”;
    $no_night=0;
    }
    // partly cloudy
    elseif ($wxInfo[’CONDITIONS_STATUS’]==” && ($wxInfo[’CONDITIONS_SEVERITY’]==” || $wxInfo[’CONDITIONS_SEVERITY’]==’0′) && $wxInfo[’CLOUDS_STATUS’]==’1′)
    {
    $wxInfo[’ICON’]=”1cloud_norain$icon_extension”;
    $no_night=0;
    }
    // clear skies
    elseif ($wxInfo[’CLOUDS_STATUS’]==’0′)
    {
    $wxInfo[’ICON’]=”0cloud$icon_extension”;
    $no_night=0;
    }
    // overcast
    elseif ($wxInfo[’CLOUDS_STATUS’]==_OVERCAST)
    {
    $wxInfo[’ICON’]=”4cloud_norain$icon_extension”;
    $no_night=1;
    }

    // if night, icon is different
    if((intval($now)>=$sunset_hour && intval($now)< ='24' || intval($now)>= ‘0′ && intval($now)< =$sunrise_hour) && !$no_night) $wxInfo['ICON']= "n_".$wxInfo['ICON'];

    // debug
    //echo "Cond status ".$wxInfo['CONDITIONS_STATUS']." Cloud stat ". $wxInfo['CLOUDS_STATUS']." Cond severity ".$wxInfo['CONDITIONS_SEVERITY'];
    /////////

    if ($use_icon_status == 'yes' && $wxInfo['ICON']<>”) $weather = $weather . “".$icon_alt_text."\n

    “;

    if ($display_temperature == ‘yes’)
    {
    if ($temperature==’C') $weather = $weather . “

    ” ._TEMPERATURE.”
    “.$wxInfo[’TEMP_C’].”°C

    \n”;
    else $weather = $weather . “

    ” ._TEMPERATURE.”
    “.$wxInfo[’TEMP_F’].”°F

    \n”;
    }
    if ($display_wind_chill==’yes’ && $wxInfo[’WIND CHILL’]<>”) $weather = $weather . “

    ” ._WIND_CHILL.”
    “.$wxInfo[’WIND CHILL’].”

    \n”;
    if ($display_heat_index==’yes’ && $wxInfo[’HEAT INDEX’]<>”) $weather = $weather . “

    ” ._HEAT_INDEX.”
    “.$wxInfo[’HEAT INDEX’].”

    \n”;
    if ($display_humidity==’yes’ && $wxInfo[’HUMIDITY’]<>”) $weather = $weather . “

    ” ._HUMIDITY_W.”
    “.$wxInfo[’HUMIDITY’].”

    \n”;
    if ($display_wind==’yes’ && $wxInfo[’WIND’]<>”) $weather = $weather . “

    ” ._WIND.”
    “.$wxInfo[’WIND’].” $wind_unit

    \n”;
    if ($display_dew_point == ‘yes’)
    {
    if ($temperature==’C') $weather = $weather . “

    ” ._DEWPOINT.”
    “.$wxInfo[’DEWPT_C’].”°C

    \n”;
    else $weather = $weather . “

    ” ._DEWPOINT.”
    “.$wxInfo[’DEWPT_F’].”°F

    \n”;
    }
    if ($display_barometer==’yes’ && $wxInfo[’BAROMETER’]<>”) $weather = $weather . “

    ” ._BAROMETER.”
    “.$wxInfo[’BAROMETER’].”

    \n”;
    if ($display_clouds==’yes’ && $wxInfo[’CLOUDS’]<>”) $weather = $weather . “

    ” ._CLOUDS.”
    “.$wxInfo[’CLOUDS’].”

    \n”;
    if ($wxInfo[’CONDITIONS’]<>”) $weather = $weather . “

    ” ._CONDITION.”
    “.$wxInfo[’CONDITIONS’].”

    \n”;
    if ($display_visibility==’yes’ && $wxInfo[’VISIBILITY’]<>”) $weather = $weather . “

    ” ._VISIBILITY.”
    “.$wxInfo[’VISIBILITY’].”

    \n”;

    $weather = $weather . “

    \n”;
    }// else

    echo $weather; // This is the call that writes out the content.

    } // End WeatherIcon Function
    little plugin.

  36. Andrew Krespanis Says:

    AAAAHHHH!!! I put it all inside <code> tags and it STILL got chewed up!
    Jeremiah: Email me if you want the code. :)

  37. jesstech Says:

    Paul: Yeah, I fixed mine after staring at it today. I had an extra space before the opening slash in my absolute path. Works now!

  38. Yablog Says:

    More Weather

    WeatherMoreIcon(’EGPH’,'Edinburgh,Scotland’);
    WeatherMoreIcon(’EGLC’,'London,England’);
    WeatherMoreIcon(’KNYC’,'New York,New York’);

    Updated and cached every 30 minutes.
    Locations: Edinburgh Airport, London City Airport and…

  39. Scott Says:

    Great plugin! Only thing I wonder is possible is to have the plugin return some type of default “the plugin is disabled” type of text rather than getting a PHP error if it’s disabled?

  40. Kenny Says:

    Good Stuff, almost got it the way I like. Having a little trouble.
    How do you get rid of the dots/bullets in front of the weather?
    Also how do you bold the weather titles?
    I tired adding;
    .weather_title { font-weight: bold; }
    .weather { text-align: center; }
    .weather ul li { text-align: center; }

    to my “wp-layout.css” file, but no go.

  41. Scott Says:

    Ok here’s my solution for when the plugin is deactivated: checking to see if the WeatherIcon function exists before calling it. Here’s my modified code in index.php to check it:


    < ?php if(function_exists(WeatherIcon)) { WeatherIcon('KJAX','Jacksonville, FL'); } ?>

    If the plugin is deactivated, the space where the weather would normally be displayed is simply *poof* gone. Activate the plugin and it’s back.

  42. Scott Says:

    Grr… forgot that code inside a <code&gr; tag vanishes if not formatted :(


    <?php if(function_exists(WeatherIcon)) { WeatherIcon('KJAX','Jacksonville, FL'); } ?>

  43. Scott Says:

    Kenny, try this:


    .weather li { text-align: center; list-style-type: none; }

  44. Joe W. Says:

    Great job! Much simpler than the Weather_Services Pear component. What license is this released under? Can I safely use this on commercial sites?

  45. Jeremiah Says:

    Scott:
    Thats pretty cool! Thanks!

    Joe W.:
    License is GPL.
    I don’t foresee any problems with using it on a commercial site.

    –Jeremiah

  46. Seth Says:

    Jeremiah,

    What would I need to do to run this as a stand-alone script (outside of WP) or embedded in a non-WP page? I use ExpressionEngine and would love to use your plug-iin with my EE-based sites either by embedding the PHP or, if you’d allow it, converting your script into an EE plug-in.

    Thanks.

    -Seth

  47. Jeremiah Says:

    Seth,
    It’s really not very dependent on wordpress.

    just do a php include for the main file like this: “include_once(’weather.php’);”
    into the page that you want the weather to appear on, and then follow the instructions that are in the download.

    thats pretty much it.

    if you have any trouble, let me know. but that should work.

    –Jeremiah

  48. Rippleweb Says:

    Wordpress Weather Plugin for ExpressionEngine
    NOTE: All of these instructions use an example URL of http://www.example.com. Change these URL references to your server address as necessary. NOTE: Jeremiah's original Wordpress plugin did not contain the /weather-plugin/weather_cache folder …

  49. rYnoweb Says:

    Nice weather mod!

    Got it up and running on my blog rYnoweb .com

    Good work!

  50. Les Says:

    Very nice work. Added it to my site and love the results. Thanks.

  51. Aaron Says:

    I installed it. It gets the information but I can’t get rid of an error. I have tried what I can think of with the cash but my idea’s don’t seem to work. I currently took it off my site until it is figured out but this is the error.

    Warning: fopen(http://www.woolever.com/wordpress/wp-content/plugins/weather_cache/metar_cache_KUGN.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/wooleve/public_html/wordpress/wp-content/plugins/weather.php on line 259

    If you have any suggestions I would appreciate it. It seems like a simple fix but I am missing something

    Aaron

  52. Asherah Says:

    Can this be used with MT at all? I don’t use (nor like) WP, but i LOVE this plugin and would really like to implement it on my MT blog. Thanks!! :)

  53. dkaye Says:

    great job on the plug-in. really like it. didn’t read through the posts above, but i noticed on your page you have a “feels like” entry - not finding it in the code? is it also available?

  54. Paolo Says:

    I think before this becomes a huge issue, someone might leave some information on how to find your local weather code if you don’t live in the U.S.

    I live in Montreal, Quebec in Canada. So far I can’t locate any weather code relevant to this plugin for my area.

  55. Alvin Says:

    your weather plugin is slick! But do you notice the icon background interlace is black when displed on IE? It display just fine in Firefox, which is transparent. But hey, Fireox is the best, so….

    Thanks a lot.
    Pay my site a visit sometime if you will, and write smth down in the guestbook. I would really appreciate it :)

    Alvin

  56. Jeremiah Says:

    Paolo:
    did you try here?:
    http://weather.gov/tg/siteloc.shtml

    these are the stations I found:
    Montreal / Dorval International, Que (71627, CYUL)
    Montreal / Mirabel (—–, CYMX)
    Montreal River Radar Site (—–, CWGJ)

    –Jeremiah

  57. Orlando Says:

    Hi,
    Is it possible to display both fahrenheit and celsius temps?

  58. william doyle Says:

    i am not sure what to put into the cache path…..

    can someone help me?

  59. Brandon Says:

    I’m trying to use this plugin on a wordpress page hosted on an intranet. I’ve tried three weather plugins now that query outside weather sources (obviously) and none of them work. I keep getting errors that eventually turn out to “weather data not available.” I can’t imagine why there would be a problem querying another website since I can link to outside sites just fine, but I’m just having no luck. Any suggestions would be much appreciated.
    -Brandon

  60. Michael Katzmann Says:

    The results returned by this hack are a little odd and differ from other weather programs that use NOAA.

    At the moment I see Conditions: mist and the icon shows 4cloud_norain but looking at the cache file I see

    KDCA 121351Z 05006KT 2 1/2SM RA BR BKN009 OVC014 08/07 A3023 RMK AO2 SLP235 P0018 T00830067

    Shouln’t the RA indicate rain? (It’s pretty wet out side 8-)

  61. pei Says:

    hi, okays, i am not the best computer person so i dont really know how to do this weather thing… i am so confused… errr..is there some other way to do this or can i get a walk-through/ step by step help?? hehe.. thanks. :P
    ps: i am just lousy that way…heheh *grinn*

  62. Joachim Says:

    Hi,
    I wanted like Seth to use the Weather-Plugin outside WP. But that doesn’t work. I include weather/weather.php which ist together with and the language.php and the pics in a folder called weather, but nothing to see. Can you help?

  63. symaski62 Says:

    http://weather.noaa.gov/pub/data/observations/metar/stations/LFQQ.TXT

    index.php

    ??? text ???

    SVP

  64. Anonymous Says:

    Good morning, I am new to this site. I have just learned about this site. I am going to read on and it’s very interesting to know

  65. Sonicpling - Jeremiah's Blog &raquo; Weather Icon - Translations Says:

    Thanks to Luc-Marie there is now a french translation of the language.php file for Weather Icon (the wordpress plugin displaying the current conditions that you see to […]

  66. Isa Says:

    Hi!
    Just to say that I’m using your weather hack in my blog, (not wordpress, just a simple home made php scritp ^^), at it works just fine ;)
    Thanks

  67. Thompas blog &raquo; WordPress 1.2.2 Says:

    1.2.1 innan sÃ¥ det var inga större problem. Det enda som var lite struligt var att mitt Weather plugin stulade lite. Vet inte om det var slumpen som gjorde att det kajkade u […]

  68. WP CheatSheet &raquo; weathericon Says:

    12/18/2004 weathericon Filed under: plugins &#8212; site admin @ 5:02 pm Download from here On index.php insert between any li tags in &#8220;menu&#8221; eg […]

  69. TG Says:

    This is a great plugin. Thank you for developing it and distributing. I really like the icons too. Question: Is there a version that doesn’t include the html output? I’d love a version of the function that would return an array with my desired data… any thoughts? thanks.

  70. TG Says:

    Got it… you can just return the wxIcon array from the weathericon function…

  71. catcher Says:

    I’m using two locations, each with their icon of course, on the same page.
    When one of the locatians enters nighttime and starts using the nighttime icons, the other location (wich is 6 hours back) starts using nighttime icons as well.
    One of the reasons I’ve put them next to one another is to show a sun icon where the other uses nighttime to visually show the difference between the 2 locations.

    Did I misconfigure something or is it something else?

  72. Jeremiah Says:

    Catcher:
    You need to comment out the line that reads:
    $local_time = '-5'; ... (Around Line 58)

    Then change the line that reads:
    function WeatherIcon($station='KLFK', $location='Lufkin, Texas') { (Around line 36)

    to read like this:
    function WeatherIcon($station='KLFK', $location='Lufkin, Texas', $local_time = '-5') {

    then having done that, change the call on your page to include the GMT offset like this:
    php WeatherIcon('KLFK','Lufkin, Texas','-5')

    Hope that helps.
    –Jeremiah
    jeremiah AT sonicpling.net

  73. catcher Says:

    Thnx very much for the quick response Jeremiah.

    It works fine now after I made the adjustments.
    Thnx for this awesome plugin :-)

    Are you planning to put in a display date function in the future?
    I’m using an extra Jvscript to this now.

  74. Jeremiah Says:

    Catcher:
    I wasn’t planning on adding a date function, but it would be trival in php.
    see here (second comment down): http://us4.php.net/manual/en/function.gmdate.php
    and here for some more formatting options: http://us4.php.net/date

  75. Matt Says:

    I am not using Wordpress, but rather b2 and I tried to initiate the plugin by calling the file and then inputting the line of code from the Instructions file. I get this error on my page.

    Warning: fopen(): open_basedir restriction in effect. File(/home/youruser/public_html/wordpress/wp-content/plugins/weather_cache/metar_cache_KNYC.txt) is not within the allowed path(s): (/home/lastpage/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/lastpage/public_html/blog/weather.php on line 313

    Warning: fopen(/home/youruser/public_html/wordpress/wp-content/plugins/weather_cache/metar_cache_KNYC.txt): failed to open stream: Operation not permitted in /home/lastpage/public_html/blog/weather.php on line 313
    # Conditions Debug

    That appears in the sidebar where the weather image should show up. I get all the details but I think something went a bit wrong. If someone could please look at it and check it out. My site is at: http://www.thelastpageonthenet.com

  76. Gonéri Says:

    thanks for this module !

  77. Dave Says:

    Hi!
    After I’ve inserted your weather plugin my blog homepage doesn’t validate ad valid XHTML 1.0 transitional…
    it says:
    document type does not allow element “li” here; missing one of “ul”, “ol”, “menu”, “dir” start-tag

    <li id="weather-LIBD" class="weather">Bari,
    Italy<ul><li><img src="http://www

    Any hack to fix this?

  78. mat Says:

    The path to my webserving directory has a tilde ~ in it, so when I add ~ in the path to the icons folder it gets changed to %7E when served and therfore the image is broken, how do I get around this?

  79. Jeremiah Says:

    Mat:
    I tried adding a tilde into my path here and it came out ok.
    can you point me at an example, or email me your weather.php file?
    jeremiah AT sonicpling.net

  80. Mike Purdy Says:

    This is a really great, and easy to use plug in. I’ve recently modified it a bit (and drawn my own icons) to use in my “header”. I’ve had a problem, in that it doesn’t seem to understand that it’s night when it invokes the “4cloud_norain” image. Other than that, Great work!

  81. Les Bessant Says:

    Woo hoo! Just got this working on my test site using WP 1.5 Beta. Works just the same as in 1.2, which is a Good Thing :-).

    Thanks again for developing this really nice plugin.

  82. Rehan Says:

    Hi Jeremiah,

    This is a great plugin and I really like the images you have with them. One problem is that I keep getting the error about weather data not being avaialable when I use OPRN for Islamabad Pakistan. On the NOAA site they have current weather info however for Islamabad. Right now I’m using the Get Weather plugin because that allows me to use codes from weather.com for getting the weather. Is there something that I’m doing wrong ? Please help when you get a chance! Thanks a lot!

  83. Femtosecond Says:

    Warning: weathericon(language.php): failed to open stream: Permission denied in /home/.valdezheater/tmac/muonproof.com/wp-content/plugins/weather.php on line 76

    Warning: weathericon(): Failed opening ‘language.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.valdezheater/tmac/muonproof.com/wp-content/plugins/weather.php on line 76

    Warning: fopen(http://muonproof.com/wp-content/plugins/weather_cache/metar_cache_CYGK.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/.valdezheater/tmac/muonproof.com/wp-content/plugins/weather.php on line 313

    What permissions does this stuff have to be?

  84. hterry Says:

    K I’m somewhat bewildered here, when I install the weather.php I get this message,

    Warning: fopen(/home/youruser/public_html/wordpress/wp-content/plugins/weather_cache/metar_cache_KCHS.txt): failed to open stream: No such file or directory in /home/hterry3/public_html/wp-content/plugins/weather.php on line 313

    now line 313 is if ($fp = fopen($metar_cache, “w”)) {

    am I to just make a blank file named this or what?

  85. pzgamer Says:

    I get that error.

    Warning: fopen(/home/enmg/public_html/wordpress/wp-content/plugins/weather_cache/metar_cache_KUCA.txt): failed to open stream: No such file or directory in /home/enmg/public_html/maxedout/wp-content/plugins/weather.php on line 313

  86. Jeremiah Says:

    pzgamer,
    1. create a folder inside your “plugins” folder and call it “weather_cache”
    2. set the permissions on the “weather_cache” folder to 777
    3. open the “weather.php” file and change line 66 from this:

    $cache_path = '/home/enmg/public_html/wordpress/wp-content/plugins/weather_cache';

    to this:

    $cache_path = '/home/enmg/public_html/maxedout/wp-content/plugins/weather_cache';

    that should solve it.

    –Jeremiah

  87. Jan Says:

    can anyone make a workaround how to handle this script for a non wordpress user?
    can lycos handle the weather_cache

  88. Sumeet Singh Says:

    Hi.. Saw your plugin but is it available for New Delhi, India? I cant find the location to add..

  89. Hannah Says:

    Great plugin, once I stopped being difficult! :) Thanks!

  90. Nathan Nutter Says:

    Thanks for making this plugin I really like it! I used it on my old blog which was just my individual blog. But I wanted to have my grandpa and my brother write too so I created Enduring Voices. Now with the runphp plugin and your plugin we can have the weather in each user’s profile. Very cool.

    I used it in my profile here at http://enduringvoices.com/wptest/

  91. Streak Running Weblog » Blog Historie Says:

    tware: Wordpress v1.5 Beta (Freeware) Template: Conestogastreet by Theron Parlin Plugin 1: WeatherIcon v1.9 Plugin2 : Comment Analysis v1.2 No Comments » […]

  92. Sean Says:

    Hi,

    First of all - it’s a great plugin :-). Got it installed, but I do have some problems with my CSS connected to it. Hope that someone here can help me out. If you take a look at http://sean.journeypix.com, you will se that it display the weather on the sidebar. What I would like is:

    - Get away the bullet in front of the city and country title.
    - Get the weather image in center
    - Avoid that all the headline titles (like search and so on) get centrated.

    Also tried to figure out how to add two cities to the same page. Tried to put two functions with cities but then I got a error.

    I appreciate any help!

    Thanks.

  93. Mike Says:

    Hi, I like the look of your weather plugin and wanted to try and get it working on my non-wp site. I put < ?php include_once("weather.php"); ?> in my index.php but I get this error “Parse error: parse error, unexpected T_VARIABLE in /home/miijo/public_html/weather/weather.php on line 49″. Is there something else I need to do to get this working? Thanks.

  94. Chris Says:

    Really enjoying the plugin, but I am having some diffciulty finding a way to removing the bullet from the weather icon. I tried Scott’s tip in 42, but didn’t do the trick. I am thinking it may have something more to do with the setup of my site through the CSS file. I’m currently using WP 1.5 w/ the default (Kubrick template). Can anyone help?

  95. Charles Says:

    Greta plugin! Have you thought about creating one using TAF format for forecasts?

    Thanks!

  96. efe Says:

    OK, nice plug-in but how to change Farenheit to Celsius? :)

  97. BOK » Blog Archive » WP weather plugin Says:

    « HTML Validator WP weather plugin Installed a weather plugin for WordPress today. You can see on the right side of […]

  98. P O V » Added the Weather Plugin Says:

    uds: overcast P O V Talking to myself…. Added the Weather Plugin from Jeremiah tonight. Pretty nifty; now all I have to do is come up with real area photo […]

  99. Vkaryl Says:

    Using your comments to Seth, above, I successfully installed this applet on a site which uses php includes - works great, and thanks for the ease of use! (I had the same problem as your weather plugin shows above earlier - had to manually delete the cache file to fix it….)

  100. Vkaryl Says:

    Jeremiah, what would be the possibility of somehow munging in a way to display the moon’s phases with this?

  101. valerie Says:

    Hey Jeremiah - works great, thanks for the awesome plugin! ;-)
    I also agree with Vkaryl - that would be a great feature, although probably pretty complicated, eh?
    Thanks!!

  102. Sonicpling - Jeremiah’s Blog » Weather Icon - Bug Fix Says:

    ilable here: weather.phps if you want the whole shebang (icons and all), then check here: weather-hack.
    No Comments
    »

    No co […]

  103. Tangled up in Purple » Blog Archive » Upgrade Time Says:

    y Matthew at guestblock.com). I also would like a weather icon thing as well. I quite like Jeremiah’s plugin. It’s clean and customisable and seems to sit happily i […]

  104. Tangled up in Purple » Blog Archive » Upgrade Time Says:

    y Matthew at guestblock.com). I also would like a weather icon thing as well. I quite like Jeremiah’s plugin. It’s clean and customisable and seems to sit happily i […]

  105. Kenny Says:

    I have been using version 1.1.7 and now 1.1.10 and works great but every so often I get this error message (in both versions).
    Warning: fread(): Length parameter must be greater than 0. in /www/k/mysite/htdocs/wp-content/plugins/weather.php on line 285

    I’m using weather from Syracuse, NY: KSYR

    Just wondering if anyone knew about this error? Thanks for the pluggin!

  106. Vkaryl Says:

    Kenny - had that a couple of times. Going into the weather_cache folder and deleting the files in it seems to fix.

  107. ./butella is back » (Aggiornamenti) Plugin Says:

    ugin Aggiunti alcuni nuovi plugin, ma di questi solo sia weighted_categories che weather MA anche image-headlines, sembrano funzionare. E’ proprio vero che non […]

  108. Dave Says:

    I’m using the plugin to display weather for a small uk market town in warwickshire. Though the reference point i have used isn’t quite ‘on target’, thats the only criticism i have! everything else has been a sinch. good work!

  109. Candace Says:

    I am using this plugin on my website at http://www.uberpink.net. I love it! I am having a lot of issues with it working with my template (The Default template on WordPress) because it is wanting to use the bullets that my template uses for the rest of the sidebar and I dont want it to use the bullets at all. I’m not exactly sure where I need to change this at! I’ve tried it in the CSS and everything!

  110. Vkaryl Says:

    Candace: here’s the relevant meta info from my redone stylesheet. Note please that I don’t use bullets anywhere, so the following css removes them all….

    .meta li, ul.post-meta li {
    display: inline;
    padding: 6px 0;
    }

    .meta ul {
    display: inline;
    list-style: none;
    margin: 0;
    padding: 0;
    }

  111. Digital Ruse Says:

    Getting an common error, and I tried everything suggested with no luck.

    Warning: fopen(/home/theruse/public_html/wp-content/weather_cache/metar_cache_KFAT.txt): failed to open stream: No such file or directory in /home/theruse/public_html/wp-content/plugins/weather.php on line 315

    No icon showing up either.

    -DR

  112. Vkaryl Says:

    Candace: should have thought to point out that I’m using the Quentin theme from http://www.pikemurdy.com, and not the default…. Sorry.

  113. Chari Says:

    Great job! Thanks so much. I was able to get it working wonderfully with MT3.x [should work just as well with 2.x]. If anyone needs info on how to do it, shoot me an email at chariATcdaigDOTcom.

  114. Scream louder » Weather Plugins For Wordpress Says:

    ather, and is available here. Matt also tried to get one yet stumbled across this one - Weather hack; I think the icons are better but he’s had a bit of problem gettin […]

  115. Historia de una Ida y una Vuelta » Plugins Says:

    ción muy buena. BBCode - Añade soporte para el código BBCode que se usa en muchos foros. WeatherIcon - Este es algo más complicado de usar y es el que da soporte al bloque de […]

  116. Bob Says:

    Hi Jeremiah,

    Great plugin :). I’m having an odd issue though. I want to use the .png icons in /wicons/ but for some odd reason, they don’t even load up at all. I am using Opera too, also checked in Firefox. I uploaded them to the correct folder location, but when I try to view any of them, they don’t load at all. I have them stored at mindwiped.com/gurlrider/wp-images/wicons/ … is there a specific manner of uploading them that I am missing? They show up fine too when I browse the folder with them on my harddrive via Thumbnail browsing. Any clue as to how to resolve this? Should I try uploading them in a specific Transfer Type; ASCII or Binary? Any help would be grealty appreciated with this issue.

    Bob

  117. Bob Says:

    Nevermind that last post Jeremiah. I reuploaded them in BINARY transfer type and they worked :). You might wanna add that to the instructions as a noted tip just in case anyone else comes across that same minor issue heh.

    Thanks again for the kickass plugin :)