Weather Icon - Again
Wow, last post was on Sep 3.
I’m so lazy.
In case you’re interested (and didn’t already know) the newest version of the code for the little weather do-dad you can see to the right is available here: weather.phps
if you want the whole shebang (icons and all), then check here: weather-hack.
October 16th, 2004 at 7:18 pm
Love it! I put it on my site today.
October 18th, 2004 at 2:44 pm
I must say the script is a beauty, but I have located a minor bug in the script (not sure if this is the best place to mention it). If you are using multiple stations (one after another on the menu), the conditions of one will carry to the other, assuming it doesn’t have a condition of its own. For example I’m in Regina (CYQR). At the moment it is snowing with blowing snow. My second one is Bermuda (TXKF), which is currently a little cloudy, and about 30 degrees C (much warmer, incapable of snow). If I display them in the order I just listed, it claims it is snowing in Bermuda (a news story in itself I believe). In any case, reversing the order makes everything perform as expected. I tracked the problem to the variable $conditions in get_conditions, ie:
.function get_conditions($part, &$metarPtr, &$group, &$wxInfo,$visibility_unit,$wind_unit) {
static $conditions='';
I have patched mine version changing this line to:
global $conditions
and in the main function (WeatherIcon) making the following changes
function WeatherIcon($station='CYQR', $location='Regina, SK') {
global $Itemid, $conditions;
...
$weather='' // ...
$conditions='' // clears condition data
...
This is a kludge fix, but I figured I’d let you know. For reporting purposes, I’m running the newest version of the code available (ie what is presented above - 1.1.5).
Thanks again for the code.
October 18th, 2004 at 2:46 pm
Oh and the obvious semi-colons where I missed ‘em too … (I really should have just cut and pasted … *sigh*)
October 21st, 2004 at 11:55 am
Found another possible bug. Wind data sometimes doesn’t contain a speed. In the case of today it read: “Wind Speed: Calm km/h.” Replacing this line:
- ” ._WIND.” “.$wxInfo[’WIND’].” $wind_unit
if ($display_wind=='yes' && $wxInfo['WIND']<>”) $weather = $weather . “
“;
with this
play_wind=='yes' && $wxInfo['WIND']<>”)- ” ._WIND.” “.$wxInfo[’WIND’];
{
$weather = $weather . “
if (eregi(”[0-9]”, $wxInfo[’WIND’]))
{
$weather = $weather . ” $wind_unit”;
}
$weather = $weather . “
“;
}
“Wind Speed: Calm” and still allows the other wind speeds to function normally. Since there is only one case where it a windspeed not requiring a wind unit (ie: calm), this shouldn’t break anything else.
October 21st, 2004 at 11:56 am
Okay, copy/pasting doesn’t work too well either. *sigh* It should read:
if ($display_wind=='yes' && $wxInfo['WIND']'')
{
$weather = $weather . "" ._WIND." ".$wxInfo['WIND'];
if (eregi("[0-9]", $wxInfo['WIND']))
{
$weather = $weather . " $wind_unit";
}
$weather = $weather . "";
}
October 26th, 2004 at 2:28 pm
I’m using your plugin on my wordpress site… very nice!
November 5th, 2004 at 11:17 am
the language file is turning up as a plugin now in the latest nightly WP 1.3 - it didn’t do that before, did it?
November 7th, 2004 at 2:44 am
Awesome plugin. Thanks! And I have a question for you. Would it be possible for you to send me your index.php and wp-comments.php (and any other files that one would need for your template). I really like the nice and simple design and I’d love to use yours as a base to start my design from. (I could give you credit on the page if you’d want). Thanks!
(Sorry for posting this here but I couldn’t find your email address).
December 2nd, 2004 at 8:31 pm
Hi,
Thanks for that nice plugin.
If you want I have translated the language file in french.
Feel free to ask me for it if you want it.
Luc-Marie