YaBB SE Community

Development => Completed mods => Topic started by: Jack.R.Abbit on June 09, 2003, 07:36:59 PM

Title: [Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 09, 2003, 07:36:59 PM
This mod puts a weather forecast area into your Board.

Weather Forecast (http://www.netamorphic.com/mods.by.jack/)

Features:Cities:
There are literally thousands of cities to choose from countries all over the world.  To minimize the size of the weather mod, only Japan was included.  For the rest of the city files, please download the weather-cities.zip  from the same url.  All the city files should go into the "cities" folder that is inside the "weather" folder that the install creates at your board root (ex /yabbse/weather/cities).

Cache time:
To speed things up (and reduce load on weather server), weather info is cached for between 1 and 4 hours as selected by the admin. If installing by hand, the cache directory must be made writeable (chmod 777)

Templates:
The admin can change the way the weather is displayed by modifying or making a template.  Two templates have been included (wide.tmp and slim.tmp).  Use one of those as an example to create your own.  The actual creation of templates is not something I will give you much help on.

Weather Placement:
Admin can choose to either display the weather info in the Info Center already built into the board or can choose to place it somewhere in the template.  To place it elsewhere in the template, select "Template" for Placement and then put <yabb weather> anywhere in your board template you want.
The weather is always only show on the main board index.

The screen shot shows the Wide template (standard weather forecast format) in the Info Center placement, the Slim template that was placed in the right gutter of the board template using <yabb weather>, the "Weather" section of the admin's Mod Settings pages and the user selectable options in the Profile.

The Weather mod should be installed in a folder called weather located at your board root (ex /yabbse/weather/) at the same level as Sources.

Enjoy!

I should mention that be sure to back up your data before applying this, or any, mod.  Everything I post works fine in my YaBB installation but your milage may vary.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: james1979 on June 09, 2003, 10:53:51 PM
how bout a screen shot

here is mine
http://www.supermod.org/attachments/jamesweather.gif
anywhere in the world
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: David on June 09, 2003, 11:13:42 PM
how bout a screen shot

here is mine
http://www.supermod.org/attachments/jamesweather.gif
anywhere in the world
Would be a tad cooler if it had the look of the Boardindex.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 10, 2003, 11:03:51 AM
I added a screen shot.... but with the template system, you can make it look how ever you wish... one template looks similar to that (since its pretty standard way to display the weather), but is more like the Info Center look.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Coyote on June 10, 2003, 01:25:37 PM
It would be nice if this was integrated into the calendar somehow :)

Utilizing the calendars layout.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 10, 2003, 06:18:59 PM
I'm not sure if I'm gonna use this one or not. I was going to try it on my Lycos board, but I got a message saying something about URL file access being disabled in the server config (I hate Lycos!)... I may try it on my Spaceports board (recently installed to test out [Unknown]'s new phpBB-yabb se converter).
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: truecrimson on June 11, 2003, 12:43:43 AM
Wonderful mod, excellent packaging, easiest, and smoothest install so far.  Only suggestion might be more explanation of where to unzip the additional cities, but it easy enough to figure out, and truely inconsequential compared to the overall qaulity of this mod.

Haven't had an install this smooth since the main forum, and it was one of the reasons I chose YaBB SE.  
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 08:47:04 AM
Are there install instructions somewhere?
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 09:10:00 AM
Instructions on how to install mods (any mod) are located several places on this board.

If you are doing a hand install, you'll want the .zip file.  Follow the search/action steps spelled out in the .mod file for your version of yabb.

If you are doing a BoardMod install, you'll want the .zip file.  Follow the install instructions as spelled out by BoardMod.

If you want to do a YabbPak install, you'll want the .mod.yp file.  Follow the install steps that PackMan walks you through.

Other tips/hints for installation are in the first post.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 11, 2003, 09:19:14 AM
One thing though... The DB modification file included was meant for YaBBPak, so when you try to modify the DB, you get errors. To fix this, simply add the following to the beginning:

Code: [Select]
include_once("Settings.php");
$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name) or die(mysql_error());

This will allow you to connect... Jack - I recommend you include a regular dbmod file that follows the layout of the others. This just makes things easier.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 09:31:06 AM
I guess I could do that... but from the begining I have given 100% support to YabbPaks.  I write YabbPaks because I believe in the system.  I don't really "support" anything else.  I've never even seen BoardMod... but I try to give assistance when I can.  The .zip file is 99.9% of what you need to do it some other way and I really only provide it out of courtesy.  Maybe that makes me a jackass... but no more so than those that write mods and don't provide a YabbPak at all.   ;D

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 11, 2003, 09:52:42 AM
Ok... I understand. I do agree that YaBBPaks are much more convenient than mods, but not everyone can use these, so I think it's best to provide support for both mods and YaBBPaks.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 11, 2003, 10:08:19 AM
Hmmm... While it appears that Spaceports is less restrictive, I keep getting a message of "php_hostconnect(): connection failed" on some line in getPackage.php, so I don't know what the deal is...
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 10:16:09 AM
This is happening when you are trying to download the YabbPak?  My server is up and running just fine.  I've never heard of Spaceports but perhaps they are not keen on server to server transfers.  You can upload the YabbPak yourself.  This is what I do usually anyway.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 11, 2003, 10:44:03 AM
Tried that, got a safe mode error message, so I installed it by hand. Now I can't even get to my board (404 error)... I think Spaceports doesn't like me!
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: oldiesmann on June 11, 2003, 11:26:37 AM
Ok... Finally got it installed, and got all the DB stuff done, and now I get the same stupid php_hostconnect: connect failed error, so I guess spaceports won't let you connect to another server someplace. I will test this out eventually, but I have to find a place that will actually let me test it out!
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 11:58:08 AM
I installed it thru the YabbPak and now the index page give this error:

Quote
Parse error: parse error, unexpected T_STRING in C:\sambar51\docs\YaBBSE\Sources\Subs.php on line 343

Fatal error: Call to undefined function: clicklog() in C:\sambar51\docs\YaBBSE\index.php on line 56

any ideas?
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 01:56:10 PM
no idea without knowing what Yabb Version you have or seeing what your Subs.php lines 340-345 look like.  I add one function to Subs.php and it should have shown up at the end somewhere around line 1290.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 02:31:10 PM
YaBB SE 1.5.3

Subs.php:
Quote
   {
      if ($awShow && $modSettings['weatherEnabled'] && $modSettings['weatherPlacement'] == 'Template')
      {
         echo '<div align="center">';
         include_once($boarddir . '/weather/loadWeather.php');
         echo '</div>';
      }
   }

Index.php:
Quote
/* ### Log this click ### */
ClickLog();

does that help.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 03:11:59 PM
I replaced subs.php with an unmodified version.

It displays the weather info....but I am unable to get weather codes for other cities.

And now the uninstall will not work...with the old or new subs.php
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 03:12:56 PM
hmmm not sure why that would have shown up there.  Can you modify your post and include the code from say line 310 to line 360.  evrything you posted is my code... still not sure where it is in respect to the rest of the file.  It is interesting though.  I have already been working on another issue so fi I can get this one resolved as well, I'll have an update later.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 03:17:33 PM
Quote
  if ($currentboard) {
      $request = mysql_query("SELECT t.content FROM {$db_prefix}boards as b, {$db_prefix}customTemplates as t WHERE (b.ID_BOARD=$currentboard) AND (b.ID_TEMPLATE = t.ID_TEMPLATE);");
      $temp = mysql_fetch_row($request);
      if (stristr($temp[0], "<yabb copyright>")) {
      $theTemplate = $temp[0];      
   }
    }

   if (!$theTemplate) {
      $templateFile = $boarddir."/template.php";
      if (!file_exists($templateFile))
            $templateFile = $boarddir."/template.html";
   $file = fopen($templateFile,"r");
   $theTemplate = fread($file,filesize($templateFile));
   fclose($file);
   }

   if (get_magic_quotes_runtime()) {
   $theTemplate = stripslashes($theTemplate);
   }

   ob_start();
   eval ("function yyweather()
{
   global $board,$action,$awShow,$awCode,$awScale,$modSettings,$boarddir,$boardurl;
   if ($board == '' && $action == '')
   {
      if ($awShow && $modSettings['weatherEnabled'] && $modSettings['weatherPlacement'] == 'Template')
      {
         echo '<div align="center">';
         include_once($boarddir . '/weather/loadWeather.php');
         echo '</div>';
      }
   }
}
?>$theTemplate<?");
   $yytemplate = explode("\n",ob_get_contents());
   ob_end_clean();


   if (!sizeof($yytemplate))
      die("$txt[23]: $templateFile");

   $yyboardname = $mbname;
   $time = (isset($settings[18]) ? $settings[18] : 0);

   $yytime = lang_strftime(time() + (($timeoffset + $time) * 3600));
   // display their username if they haven't set their real name yet.
   $tmp = ($realname == '' ? $username : $realname);
   $yyuname = ($username == 'Guest' ? "$txt[248] <b>$txt[28]</b>. $txt[249] <a href=\"$cgi;action=login\">$txt[34]</a> $txt[377] <a href=\"$cgi;action=register\">$txt[97]</a>." : "$txt[247] <b>$tmp</b>, ");
   $yycopyin = 0;

   $yyVBStyleLogin = '<br />';
   if ($modSettings['enableVBStyleLogin'] == '1' && $username == 'Guest')

there ya go.

any other way to get the city codes??
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 11, 2003, 03:30:57 PM
Thanks,

I think I need to change my search string a little.  I had already done that for the 1.4.1 version but did not yet for the 1.5.x verison.  You must have some type of template mod installed.

these lines:
Code: [Select]
 ob_start();
  eval ("function yyweather()
{
   global $board,$action,$awShow,$awCode,$awScale,$modSettings,$boarddir,$boardurl;
   if ($board == '' && $action == '')
   {
      if ($awShow && $modSettings['weatherEnabled'] && $modSettings['weatherPlacement'] == 'Template')
      {
         echo '<div align="center">';
         include_once($boarddir . '/weather/loadWeather.php');
         echo '</div>';
      }
   }
}
?>$theTemplate<?");
should look more like:
Code: [Select]
 ob_start();
  eval ("?>$theTemplate<?");
It inserted my function into the middle of some other code.  I wasn't expecting to find more than one "?>" in that file.  A horrible mistake on my part.  Sorry.  I will get that sorted out in the update soon.

"Any other way to get the city codes?"  What do you mean?  The codes are unique to each city and are contained in the lists.  I chose to include the lists so that the mod would not rely too heavily on the weather server site.  It was the best option I came up with but I am open to suggestions.  How would you suggest to do this?  What is it about this way you wish to change?

Thanks.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 11, 2003, 05:08:03 PM
It won't let me change the city code...where can I manually do enter this code??
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: darthpaul on June 12, 2003, 01:15:22 PM
I have applied the mod in boardmod with no problems and the database mod done, all files uploaded, changed the city in modsettings and set it to show in info center...and it doesnt show  ??? any ideas?
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: [Unknown] on June 12, 2003, 06:47:44 PM
Please note that the xml_array class included within the mod is NOT to be assumed to be open source.  If you are using this class, which I wrote, understand that you cannot redistribute it - I only gave Jack.R.Abbit the right to do that.

Yes, maybe this should have been included in the mod, it was a minor oversight.

I have not decided what license to put my class in yet, but as current it is under the 'default' lisence, which means you cannot redistribute or re/reverse engineer it.

Thank you for your understanding,
-[Unknown]
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 12, 2003, 06:51:30 PM
my bad... I totally forgot about that... by the time I got everything working I was just ready to release it... again.. my bad.   Should have noted that.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 12, 2003, 08:20:15 PM
I still need to know where to enter the code manually in the specific file...
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 12, 2003, 11:04:01 PM
Sorry.  If you don't want to do the "popup and browse" method by clicking the little "!" icon next to the textbox, you would need to make it so that the textbox is not "read only" so you can type one in.  You will still need to aquire a valid city code which would be found in those city files in the weather-cities.zip.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: GauGau on June 13, 2003, 04:02:40 AM
just in case someone is interessted: German template for weather forecast mod (not only a translation, but a conversion of units and decimal etc.). With this, it should be easy to translate this great mod into other languages, too.

Screenshot:
(http://gaugau.de/download/uploads/yabb/mod/weather/wide.gif)

Instructions:
create a file in /yabbse/weather/templates/wide_de.tmp, copy and paste the following code into it, save it, upload to your webserver and choose "wide_de.tmp" in mod settings.


Code: [Select]
<?php

//deutsche begriffe definieren:
setlocale(LC_ALL,"de_DE");
$de_datum=strftime("%A, %d.%B %Y, %H:%M h",strtotime($xml->fetch('weather/date')));

function 
de_wochentag($wochentag)
{
$de_wochentag = array(
'MONDAY' =>'Montag',
'TUESDAY' =>'Dienstag',
'WEDNESDAY' =>'Mittwoch',
'THURSDAY' =>'Donnerstag',
'FRIDAY' =>'Freitag',
'SATURDAY' =>'Samstag',
'SUNDAY' =>'Sonntag');
return 
$de_wochentag[$wochentag];
}

function 
hg_to_bar($value)
{
//details: http://www.chemie.fu-berlin.de/chemistry/general/units.html
return floor((760+$value)*1.333224);
}

function 
de_wetterbeschreibung($value)
{
//details: see http://weather.interceptvector.com/wid.php
$de_wetterbeschreibung = array(
'Windy' =>'windig',
'Thunder Storms' =>'Gewitter',
'Snow' =>'Schnee',
'Rain' =>'Regen',
'Sleet' =>'Graupel',
'Heavy Rain' =>'starker Regen',
'Light Flurries' =>'leichter Schneefall',
'Flurries' =>'Schneefall',
'Snow' =>'Schnee',
'Dust' =>'Staub',
'Fog' =>'Nebel',
'Haze' =>'Dunst',
'Smoke' =>'Rauch',
'Windy' =>'windig',
'Cold' =>'kalt',
'Cloudy' =>'bewölkt',
'Mostly Cloudy' =>'überwiegend bewölkt',
'Partly Cloudy' =>'teilweise bedeckt',
'Sunny' =>'sonnig',
'Mostly Sunny' =>'überwiegend sonnig',
'Hot' =>'heiss',
'Snow and Wind' =>'Schnee und Wind',
);
if (
$de_wetterbeschreibung[$value]!=""){return $de_wetterbeschreibung[$value];}else{return $value;}
}

function 
replace_dot($value)
{
return 
str_replace(".",",",$value);
}

function 
east_ost($value)
{
return 
str_replace("E","O",$value);
}

function 
miles_to_km($value)
{
return 
floor($value/1.6);
}

  echo 
'
<style type="text/css">
<!--
.smValBold_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; }
.lrgValBold_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color: Red; }
.smVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; }
.smLabel_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; color: Maroon; }
.medLabel_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; }
.hiVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; color: red; }
.loVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; color: blue; }
.smText_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; }
-->
</style>
<table border="0">
  <tr>
    <td colspan="5" align="left">
      <span class="medLabel_W">Region:</span>
      <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: Black;">' 
$xml->fetch('weather/region') . '</span><br />
      <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color: Blue;">' 
$location '</span><br />
    </td>
  </tr><tr>
    <td colspan="5" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="3" align="left"><span class="medLabel_W">Derzeitige Wetterlage:</span></td>
    <td colspan="2" align="right"><span class="smText_W">vom ' 
$de_datum '</span></td>
  </tr><tr>
    <td align="center"><span class="lrgValBold_W">' 
replace_dot($xml->fetch('weather/temp')) . '°' $tScale '</span></td>
    <td align="center"><img src="' 
$base_url $icons $xml->fetch('weather/wid') . '.gif" width="36" height="36" alt="" border="0"></td>
    <td align="center"><span class="smValBold_W">' 
de_wetterbeschreibung($xml->fetch('weather/sky')) . '</span></td>
    <td> </td>
    <td align="left">
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><span class="smLabel_W">Gefühlte Temperatur:</span</td>
          <td><span class="smValBold_W">' 
replace_dot($xml->fetch('weather/realtemp')) . '°' $tScale '</span></td>
          <td>  </td>
          <td><span class="smLabel_W">UV Index:</span></td>
          <td><span class="smValBold_W">' 
$xml->fetch('weather/uv') . '</span></td>
        </tr>
        <tr>
          <td><span class="smLabel_W">Luftfeuchtigkeit:</span</td>
          <td><span class="smValBold_W">' 
$xml->fetch('weather/humidity') . '%</span></td>
          <td>  </td>
          <td><span class="smLabel_W">Wind:</span></td>
          <td><span class="smValBold_W">' 
miles_to_km($xml->fetch('weather/wind/strength')) . ' km/h aus 'east_ost($xml->fetch('weather/wind/direction')) . '</span></td>
        </tr>
        <tr>
          <td><span class="smLabel_W">Sicht:</span</td>
          <td><span class="smValBold_W">' 
miles_to_km($xml->fetch('weather/visibility')) . ' km</span></td>
          <td>  </td>
          <td><span class="smLabel_W">Luftdruck:</span></td>
          <td><span class="smValBold_W">' 
hg_to_bar($xml->fetch('weather/barometer')) . ' <acronym title="Hektopascal" class="tool">hPa</acronym> (<acronym title="Millibar" class="tool">mb</acronym>)</span></td>
        </tr>
      </table>
    </td>
  </tr>
    <td colspan="5" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="5" align="left"><span class="medLabel_W">' 
$xml->count('weather/forecast') . ' -Tage Vorhersage:</span></td>
  </tr><tr>
    <td colspan="5" align="center">
      <table>
        <tr>'
;
  foreach(
$xml->set('weather/forecast') as $forecast)
    echo 
'
          <td> </td>
          <td valign="top" align="center">
            <span class="smValBold_W">' 
de_wochentag(strtoupper($forecast->fetch('day'))) . '</span><br />
            <span class="hiVal_W">Hoch: ' 
replace_dot($forecast->fetch('high')) . '°' $tScale '</span><br />
            <span class="loVal_W">Tief: ' 
replace_dot($forecast->fetch('low')) . '°' $tScale '</span><br />
            <img src="' 
$base_url $icons $forecast->fetch('wid') . '.gif" width="36" height="36" alt="" border="0"><br />
            <span class="smVal_W">' 
de_wetterbeschreibung($forecast->fetch('sky')) . '</span>
          </td>'
;
  echo 
'
          <td> </td>
        </tr>
      </table>
    </td>
  </tr><tr>
    <td colspan="5" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="5" align="center"><span class="smText_W">XML Wettervorhersage erstellt durch <a href="' 
$xml->fetch('weather/provider[0]/url') . '">' $xml->fetch('weather/provider[0]/name') . '</a><span></td>
  </tr>
</table>'
;
?>

GauGau
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: GauGau on June 13, 2003, 04:04:37 AM
same thing for slim_de.tmp (too many characters for one post ;)):

Code: [Select]
<?php

//deutsche begriffe definieren:
setlocale(LC_ALL,"de_DE");
$de_datum=strftime("%A, %d.%B %Y, %H:%M h",strtotime($xml->fetch('weather/date')));

function 
de_wochentag($wochentag)
{
$de_wochentag = array(
'MONDAY' =>'Montag',
'TUESDAY' =>'Dienstag',
'WEDNESDAY' =>'Mittwoch',
'THURSDAY' =>'Donnerstag',
'FRIDAY' =>'Freitag',
'SATURDAY' =>'Samstag',
'SUNDAY' =>'Sonntag');
return 
$de_wochentag[$wochentag];
}

function 
hg_to_bar($value)
{
//details: http://www.chemie.fu-berlin.de/chemistry/general/units.html
return floor((760+$value)*1.333224);
}

function 
de_wetterbeschreibung($value)
{
//details: see http://weather.interceptvector.com/wid.php
$de_wetterbeschreibung = array(
'Windy' =>'windig',
'Thunder Storms' =>'Gewitter',
'Snow' =>'Schnee',
'Rain' =>'Regen',
'Sleet' =>'Graupel',
'Heavy Rain' =>'starker Regen',
'Light Flurries' =>'leichter Schneefall',
'Flurries' =>'Schneefall',
'Snow' =>'Schnee',
'Dust' =>'Staub',
'Fog' =>'Nebel',
'Haze' =>'Dunst',
'Smoke' =>'Rauch',
'Windy' =>'windig',
'Cold' =>'kalt',
'Cloudy' =>'bewölkt',
'Mostly Cloudy' =>'überwiegend bewölkt',
'Partly Cloudy' =>'teilweise bedeckt',
'Sunny' =>'sonnig',
'Mostly Sunny' =>'überwiegend sonnig',
'Hot' =>'heiss',
'Snow and Wind' =>'Schnee und Wind',
);
if (
$de_wetterbeschreibung[$value]!=""){return $de_wetterbeschreibung[$value];}else{return $value;}
}

function 
replace_dot($value)
{
return 
str_replace(".",",",$value);
}

function 
east_ost($value)
{
return 
str_replace("E","O",$value);
}

function 
miles_to_km($value)
{
return 
floor($value/1.6);
}


  echo 
'
<style type="text/css">
<!--
.smValBold_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; }
.lrgValBold_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 15px; font-weight: bold; color: Red; }
.smVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; }
.smLabel_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; color: Maroon; }
.medLabel_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 11px; }
.hiVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; color: red; }
.loVal_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; color: blue; }
.smText_W { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; }
-->
</style>
<table border="0">
  <tr>
    <td colspan="3" align="left">
      <span class="medLabel_W">Region:</span>
      <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; color: Black;">' 
$xml->fetch('weather/region') . '</span><br />
      <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; color: Blue;">' 
$location '</span><br />
    </td>
  </tr><tr>
    <td colspan="3" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="3" align="left"><span class="medLabel_W">Derzeitige Wetterlage:</span></td>
  </tr><tr>
    <td colspan="3" align="left"><span class="smText_W">vom ' 
$de_datum '</span></td>
  </tr><tr>
    <td align="center"><span class="lrgValBold_W">' 
replace_dot($xml->fetch('weather/temp')) . '°' $tScale '</span></td>
    <td align="center"><img src="' 
$base_url $icons $xml->fetch('weather/wid') . '.gif" width="36" height="36" alt="" border="0"></td>
    <td align="center"><span class="smValBold_W">' 
de_wetterbeschreibung($xml->fetch('weather/sky')) . '</span></td>
  </tr><tr>
    <td colspan="3" align="center">
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left"><span class="smLabel_W">Gefühlte Temperatur:</span</td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">' 
replace_dot($xml->fetch('weather/realtemp')) . '°' $tScale '</span></td>
        </tr><tr>
          <td align="left"><span class="smLabel_W">UV Index:</span></td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">' 
$xml->fetch('weather/uv') . '</span></td>
        </tr><tr>
          <td align="left"><span class="smLabel_W">Luftfeuchtigkeit:</span</td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">' 
$xml->fetch('weather/humidity') . '%</span></td>
        </tr><tr>
          <td align="left"><span class="smLabel_W">Wind:</span></td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">'  
miles_to_km($xml->fetch('weather/wind/strength')) . ' km/h aus 'east_ost($xml->fetch('weather/wind/direction')) .'</span></td>
        </tr><tr>
          <td align="left"><span class="smLabel_W">Sicht:</span</td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">' 
miles_to_km($xml->fetch('weather/visibility')) . ' km</span></td>
        </tr><tr>
          <td align="left"><span class="smLabel_W">Luftdruck:</span></td>
          <td>  </td>
          <td align="left"><span class="smValBold_W">' 
hg_to_bar($xml->fetch('weather/barometer')) . ' <acronym title="Hektopascal" class="tool">hPa</acronym> (<acronym title="Millibar" class="tool">mb</acronym>)</span></td>
        </tr>
      </table>
    </td>
  </tr>
    <td colspan="3" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="3" align="center">
      <table>
        <tr>
          <td colspan="3" align="left"><span class="medLabel_W">' 
$xml->count('weather/forecast') . '-Tage Vorhersage:</span></td>
          <td align="center"><span class="hiVal_W">Hoch</span><span class="smVal_W"> / </span><span class="loVal_W">Tief</span></td>
          <td align="left"><span class="smVal_W"><acronym class="tool" title="Niederschlagswahrscheinlichkeit">NW%</acronym></span></td>
        </tr>'
;
  foreach(
$xml->set('weather/forecast') as $forecast)
    echo 
'
        <tr>
          <td align="left"><span class="smVal_W">' 
substr(de_wochentag(strtoupper($forecast->fetch('day'))), 02) . '</span></td>
          <td align="left"><img src="' 
$base_url $small_icons $forecast->fetch('wid') . '.gif" width="23" height="23" alt="" border="0"></td>
          <td align="left"><span class="smVal_W">' 
de_wetterbeschreibung($forecast->fetch('sky')) . '</span></td>
          <td align="left"><span class="hiVal_W">' 
replace_dot($forecast->fetch('high')) . '°' $tScale '</span><span class="smVal_W">/</span><span class="loVal_W">' replace_dot($forecast->fetch('low')) . '°' $tScale '</span></td>
          <td align="center"><span class="smVal_W">' 
$forecast->fetch('precipitation') . '%</span></td>
        </tr>'
;
  echo 
'
      </table>
    </td>
  </tr><tr>
    <td colspan="3" align="left"><hr noshade="noshade"></td>
  </tr><tr>
    <td colspan="3" align="center"><span class="smText_W">XML Wettervorhersage <br />erstellt durch <a href="' 
$xml->fetch('weather/provider[0]/url') . '" target="_blank">' $xml->fetch('weather/provider[0]/name') . '</a><span></td>
  </tr>
</table>'
;
?>

GauGau
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 13, 2003, 09:11:08 AM
Thanks for that... I knew the use of template s would come in handy...  ;D

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 13, 2003, 01:37:07 PM
Sorry.  If you don't want to do the "popup and browse" method by clicking the little "!" icon next to the textbox, you would need to make it so that the textbox is not "read only" so you can type one in.  You will still need to aquire a valid city code which would be found in those city files in the weather-cities.zip.

-Jack

The popup method doesn't seem to work and I am not able to manually enter a code in the preferences settings.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 13, 2003, 01:57:32 PM
hmmm.   Do any of the other popups work on that page.  I used the same method of doing it.  Do you get a JavaScript error or just no popup or does the popup not load the city code into the text box?  If you need to do it manually, then the text box must me made to be not readonly.  I set the attributes of it to be read only because I wanted to make sure a valid city code was inserted.  I guess I'll remove that part for the next release, which I should have out later today.  Just working on getting the language files modded.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 13, 2003, 05:31:13 PM
it comes up with a page to choose the states...then when you choose one it just reloads the states page.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 13, 2003, 05:44:25 PM
OK.... I think I know what the problem is.  I will have it corrected in the next release.  Which should come very soon.  Just putting some finishing touches on the language parts.

In the mean time, try adding this
Code: [Select]
$types_to_register = array('GET','POST');
foreach ($types_to_register as $type) {
  $arr = @${'HTTP_' . $type . '_VARS'};
  if (@count($arr) > 0) {
    extract($arr, EXTR_OVERWRITE);
  }
}
to the top of Yabb/weather/list.php.  LEt me know if that solves it.

Thanks,
-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 14, 2003, 11:47:24 AM
Where specifically do you want me to add this extra code?

Code: [Select]
<?php
require_once('xml_array.php');
$fileToGet = (isset($XML) ? './cities/' $XML './cities/index.xml');
$xml = new xmlArray(file($fileToGet));
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
   <title>City Listing</title>
<script language="javascript" type="text/javascript">
function changeCityCode(CityCode) {
  e = eval("window.opener.document." + window.opener.MyForm + "[window.opener.MyFormEl]");
  e.value = CityCode;
}
</script>
<style type="text/css">
BODY {
background-repeat: no-repeat;
background-image: url('map2.gif');
background-position: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
}
H1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12pt;
font-weight: bold;
color: #658AAD;
}
TH {
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
font-weight: bold;
}
TD {
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
}
A {
color: #658AAD;
}
TABLE.links {
border-width: 2px;
border-style: solid;
border-color: #658AAD;
}
TR.even {
}
TR.odd {
background-color: #E7EBEF;
}
FONT.copyright {
font-family: Arial, Helvetica, sans-serif;
font-size: 7pt;
color: #A6A6A6;
}
A.copyright {
font-family: Arial, Helvetica, sans-serif;
font-size: 7pt;
color: #A6A6A6;
}
</style>
</head>

<body>
<?php
if ($xml->count('countries') > 0) {
  echo 
'<h1>State Listing</h1>
This is a list of Countries and States that are supported by the Dynamic Weather Server. Please select one to see the cities for that state.<br />
<br />
'
;
  foreach(
$xml->set('countries/country') as $country) {
    if (
$country->count('state') > 1) {
      foreach(
$country->set('state') as $state) {
        if (
file_exists('./cities/' $state->fetch('@url')))
          echo 
'<a href="list.php?XML=' $state->fetch('@url') . '">' $country->fetch('@name') . ', ' $state->fetch('@name') . '</a><br />';
      }
    } else {
      if (
file_exists('./cities/' $country->fetch('state/@url')))
        echo 
'<a href="list.php?XML=' $country->fetch('state/@url') . '">' $country->fetch('@name') . '</a><br />
'
;
    }
  }
} else {
  echo 
'<h1>City Listing</h1>
This is a list of Cities that are supported by the Dynamic Weather Server.<br />
<center><a href="list.php">back to country list</a></center>
<br />
'
;
  foreach(
$xml->set('state/city') as $city) {
    
$cityUrl $city->fetch('@url');
    
$cityCode substr($cityUrlstrpos($cityUrl'weather.xml?id=')+15);
    echo 
'<a href="javascript:changeCityCode(\'' $cityCode '\');">' $xml->fetch('state/@name') . ', ' $city->fetch('@name') . '</a><br />
'
;
  }
}
?>



</body>
</html>

I apologize for asking so many questions...I am new to php programming.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 15, 2003, 12:14:59 AM
not a problem... sorry for asking yoo to do it.  I try not to have so many bugs in my mods when I release them... but I kinda rushed this one out.

add it starting on line 2, right afterr the <?php

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: SNC on June 15, 2003, 07:27:02 AM
That fixed it.....Thank you very much.

Now that I can get it to work....I am more then willing to recommend it to others.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: truecrimson on June 16, 2003, 07:34:10 AM
I'm glad that got fixed.  I applied the mod to 5 forums, and had a similar problem on one of them(no problems on the other 4).  I was working on sorting it out when I inadvertently destroyed the board in question.  Luckily I had a backup.  ;D
After restorng from backup, and instaling this again it worked fine, so I never figured it out.
 In my opinion the yabbpak is totally superior.  I had nothing but trouble with boardmod, so I switched to doing everything by hand in dreamweaver.  The yabbpak is much faster, smoother, and demnstrates a degree of commitment on the part of the mod author.  And I still think this is the slickest mod I have yet seen, IMHO ;D ;D
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on June 16, 2003, 12:01:53 PM
That fixed it.....Thank you very much.

Now that I can get it to work....I am more then willing to recommend it to others.

In my opinion the yabbpak is totally superior.  I had nothing but trouble with boardmod, so I switched to doing everything by hand in dreamweaver.  The yabbpak is much faster, smoother, and demnstrates a degree of commitment on the part of the mod author.  And I still think this is the slickest mod I have yet seen, IMHO ;D ;D

Thanks for your support... I'm glad this mod is wokring out for you.  I try my best. :)

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: truecrimson on July 02, 2003, 06:57:23 AM
For several days now I have been getting the following on all 5 of my forums:
Code: [Select]
2: file() [function.file]: php_network_getaddresses: gethostbyname failed
(C:\Program Files\Apache Group\Apache2\htdocs\corlissonline\yabbsecorliss\weather\loadWeather.php ln 48)
Of course the specific path for each forum is different, but otherwise the error is the same
It worked perfectly on all forums previously, and I have not changed anything or added anymore mods.  Any ideas?
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on July 05, 2003, 10:13:42 AM
I will look into it.  It seems like the weather feed has either gone or changed.  I'll let you know.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: truecrimson on July 05, 2003, 10:47:43 PM
Cool, thanks a bunch.  I really love this mod, and would hate to lose it. ;D
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Skyview on July 13, 2003, 07:08:05 AM
Hi, I just tried to install the mod through the YaBBpak which seemed to work fine.  I then d/l the cities file and ftp'd all of the xml files to the cities directory.  I am getting this error though, which seems fairly close to the one mentioned just above.  

An Error Has Occurred!

2: file() [function.file]: php_network_getaddresses: getaddrinfo failed: No address associated with hostname
(/www/s/skyviewtech/htdocs/forum/weather/loadWeather.php ln 48)
 
Is there anything I have done wrong or need to change?  Any help would be greatly appreciated.  Thanks...

David
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Jack.R.Abbit on July 13, 2003, 10:14:50 AM
It seems like the weather feed has either gone or changed.
Yes.. the weather source has vanished... I am in the process of rewritubg this mod to us a more established weather source that hopefully will not vanish anytime soon.

-Jack
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Skyview on July 13, 2003, 06:08:34 PM
Jack,

OK, thanks for the update, glad to know I didn't screw anything up  ;D  I have just disabled the weather display in admin for now until you have an update available.  Let me know if I can do anything to help.

David
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: truecrimson on July 14, 2003, 11:18:59 PM
Cool, I look forward to getting the update when you have it ready.  I still think this is the slickest mod yet.
Thanks.
Title: Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
Post by: Curry on January 09, 2004, 04:28:35 PM
hi, can somebody tell me where i can find the weather-cities.zip. I search everywhere but i didn't find it.

Thanx