06.09.05
My WeatherIcon plugin problem fixed
I fixed my little problem with the WeatherIcon. I wanted to make the various weather icons I was using in my Weather around the world page reflect the local time at the corresponding place, showing a sun if it was day and a moon if it was night. To do that I had to change the function WeatherIcon to accept one extra argument, and change one more line in the plugin file. All you have to do is edit WeatherIcon.php, replacing line 325 from
function WeatherIcon ($station='KLFK', $before = '<li>', $after = '</li>' )
to
function WeatherIcon ($station='KLFK', $before = '<li>', $after = '</li>', $differFromLocal = 0 )
and line 355 from
$now=gmdate( “H”, time()+getsettings(’gmtoffset’)6060 );
to
$now=gmdate( “H”, time()+($differFromLocal+getsettings(’gmtoffset’))6060 );
Now whenever you want a place to follow a different time, you just need to provide the corresponding time difference. I live in Chicago, so for instance if I want to show the weather in Greece, which has an 8 hour difference, I would use:
- WeatherIcon(’LGAV’, ‘
- ‘,’ ‘,8);
instead of
- WeatherIcon(’LGAV’);
Where in both cases, the phpcode tags should not have question marks, they are there to avoid processing.
This is all assuming you are using RunPHP to insert php code in your posts. Note, that there seem to be a number of runPHP versions on the web. The only one I managed to make work is the the above, where you need to include your commands in the <phpcode> tag.
Later