Welcome, Guest. Please Login or Register.
March 29, 2024, 10:56:13 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

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 22154 times)
oldiesmann
YaBB God
*****
Posts: 577


Jesus died for your sins... Have you thanked him?

oldiesmann@oldiesmann.us WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #15 on: June 11, 2003, 04:26:37 PM »
Reply with quote

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

"I've sinned greatly, but Christ's for real, baby
It's a wonder He saved me and just didn't hate me
So won't you tell Him "Save me"
Please stand up, please stand up, please stand up..." - J. Jackson (More Info)
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #16 on: June 11, 2003, 04:58:08 PM »
Reply with quote

I installed it thru the YabbPak and now the index page give this error:

QuoteParse 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?
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 #17 on: June 11, 2003, 06:56:10 PM »
Reply with quote

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
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 #18 on: June 11, 2003, 07:31:10 PM »
Reply with quote

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.
Logged
SNC
Noobie
*
Posts: 22


ICQ - 136090777 WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #19 on: June 11, 2003, 08:11:59 PM »
Reply with quote

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
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 #20 on: June 11, 2003, 08:12:56 PM »
Reply with quote

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
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 #21 on: June 11, 2003, 08:17:33 PM »
Reply with quote

Quoteif ($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??
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 #22 on: June 11, 2003, 08:30:57 PM »
Reply with quote

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:  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:  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
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 #23 on: June 11, 2003, 10:08:03 PM »
Reply with quote

It won't let me change the city code...where can I manually do enter this code??
Logged
darthpaul
Noobie
*
Posts: 36


Have It!

ICQ - 5366806paulremnant@hotmail.com WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #24 on: June 12, 2003, 06:15:22 PM »
Reply with quote

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

Interested in fishkeeping? come see my popular site www.fishcrazy.co.uk
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[Done 1.4.1 & 1.5.X] Weather Forecast Module
« Reply #25 on: June 12, 2003, 11:47:44 PM »
Reply with quote

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]
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 #26 on: June 12, 2003, 11:51:30 PM »
Reply with quote

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.
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 #27 on: June 13, 2003, 01:20:15 AM »
Reply with quote

I still need to know where to enter the code manually in the specific file...
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 #28 on: June 13, 2003, 04:04:01 AM »
Reply with quote

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
Logged

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


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


Klugscheisserei grood recht!

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

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:


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.


<?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
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.025 seconds with 19 queries.