• I have PHPWeather installed and configured correctly, but I’m having trouble figuring out what code I would add to my blog to call the weather in. Can anyone that uses this help me out? I tried using this code, which I found on the site:
    <?php
    include(‘phpweather.inc’);
    include(‘locale_en.inc’);
    $metar = get_metar(‘EKYT’);
    $data = process_metar($metar);
    $temp_c = $data[‘temp_c’];
    $temp_f = $data[‘temp_f’];
    echo “The temperature is $temp_c degrees Celsius ($temp_f degrees Fahrenheit).”;
    ?>
    But I cannot seem to find the “phpweather.inc” or “locale_en.inc” files that they are calling in and I’m getting errors. The documention and support isn’t that great for newbies such as myself. I’ve tried posting to the support mailing list but have gotten no answer.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I imagine all you have to do is make sure the file path to “phpweather.inc” and “locale_en.inc” is correct. In the case of the snippet above they would have to be in the same directory as the page calling for them. You may want to try an absolute path.
    Mine looks like:
    <?php
    include(‘/home/****/public_html/fultonchain/locale_en.inc’);
    include(‘/home/****/public_html/fultonchain/phpweather.inc’);
    $metar = get_metar(‘KSLK’);
    $data = process_metar($metar);
    pretty_print_metar_wap($metar, ‘Saranac Lake, NY’);
    ?>
    You’ll note that I’m displaying “pretty_print_metar” which is configured by modifying the function in “phpweather.inc”. In my version (not necessarily current) it starts on line 396.

    Thread Starter daisyhead

    (@daisyhead)

    But that’s just it Cedar, I can’t seem to find those 2 particular files anywhere in my weather directory. Was I supposed to create them? Or were they part of the install package?

    I see your point ??
    I just downloaded the current version and it seems there were a few more changes than I thought. If your using 2.21 I’m afraid I’m not going to be much help, it took me forever to get the old version the way I wanted it and I’m not about to mess with it now ??
    However, 1.6x is still available for download, meets my needs well and contains the two files your looking for.

    Thread Starter daisyhead

    (@daisyhead)

    Thanks for trying Cedar!
    So is there anyone else out there using v2.21 that help me figure out what code I need to place into my blog to call the weather info??

    Thread Starter daisyhead

    (@daisyhead)

    Cedar, one more question. If I wanted to remove v2.21 and use 1.6x, how would I go about doing that? Delete the SQL db and all the files and just install the older version, creating a new db and tables?
    Thanks!

    Yep, that would pretty much be it. Keep in mind that the database is only used for caching and while it will speed up the response time it isn’t strictly necessary — also, you need not create a new database, your only inserting one table (metars) so it is unlikely to conflict with anything else on a shared database.
    The docs for 1.x are a little more comprehensive than the ones for version 2.

    DaisyHead,
    I had some issue installing phpWeather, but it was just a matter of pointing to the correct database and directories and running the configuration files. Make sure you do that. Through that you can set create the default.php file that will allow you to determine the default weather station and metrics.
    Also, don’t use the DB all the time option, because it doesn’t up date as quickly. Also, make a very small cache amount. My phpWeather updates about every 45 minutes.
    I’m using mine on the main page https://www.dean-logan.com/.
    The one thing I wish it had was a “normal temperature range”. After setting that, then the current temperature can be compared to the range and the appropriate temp icon could be displayed (i.e. hotter than normal, normal, colder than normal).

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHPWeather’ is closed to new replies.