Welcome, Guest. Please Login or Register.
April 25, 2024, 07:04:59 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Completed mods  |  [Done 1.4.1 & 1.5.X] Weather Forecast Module « previous next »
Pages: 1 2 [3] 4 Reply Ignore Print
Author Topic: [Done 1.4.1 & 1.5.X] Weather Forecast Module  (Read 22382 times)
GauGau
Noobie
*
Posts: 18


Klugscheisserei grood recht!

WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #30 on: June 13, 2003, 09:04:37 AM »
Reply with quote

same thing for slim_de.tmp (too many characters for one post ;)):

<?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
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #31 on: June 13, 2003, 02:11:08 PM »
Reply with quote

Thanks for that... I knew the use of template s would come in handy...  ;D

-Jack
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #32 on: June 13, 2003, 06:37:07 PM »
Reply with quote

Quote from: Jack.R.Abbit on June 13, 2003, 04:04:01 AM
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.
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #33 on: June 13, 2003, 06:57:32 PM »
Reply with quote

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
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #34 on: June 13, 2003, 10:31:13 PM »
Reply with quote

it comes up with a page to choose the states...then when you choose one it just reloads the states page.
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #35 on: June 13, 2003, 10:44:25 PM »
Reply with quote

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$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
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #36 on: June 14, 2003, 04:47:24 PM »
Reply with quote

Where specifically do you want me to add this extra code?

<?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.
« Last Edit: June 14, 2003, 04:48:11 PM by SNC » Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #37 on: June 15, 2003, 05:14:59 AM »
Reply with quote

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
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #38 on: June 15, 2003, 12:27:02 PM »
Reply with quote

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.
Logged
truecrimson
Noobie
*
Posts: 18


The Llama has been assimilated.

WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #39 on: June 16, 2003, 12:34:10 PM »
Reply with quote

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
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #40 on: June 16, 2003, 05:01:53 PM »
Reply with quote

Quote from: SNC on June 15, 2003, 12:27:02 PMThat fixed it.....Thank you very much.

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

Quote from: truecrimson on June 16, 2003, 12:34:10 PMIn 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
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
truecrimson
Noobie
*
Posts: 18


The Llama has been assimilated.

WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #41 on: July 02, 2003, 11:57:23 AM »
Reply with quote

For several days now I have been getting the following on all 5 of my forums:
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?
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #42 on: July 05, 2003, 03:13:42 PM »
Reply with quote

I will look into it.  It seems like the weather feed has either gone or changed.  I'll let you know.
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
truecrimson
Noobie
*
Posts: 18


The Llama has been assimilated.

WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #43 on: July 06, 2003, 03:47:43 AM »
Reply with quote

Cool, thanks a bunch.  I really love this mod, and would hate to lose it. ;D
Logged
Skyview
Noobie
*
Posts: 16


WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #44 on: July 13, 2003, 12:08:05 PM »
Reply with quote

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
Logged
Pages: 1 2 [3] 4 Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [Done 1.4.1 & 1.5.X] Weather Forecast Module « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.018 seconds with 20 queries.