Global Warming Trend Script

Did the script function before you deleted the “strip_units”?

Very nice. This will make a nice addition to the wxtempdetail pg.

I’ll incorporate tomorrow and probably call the combination “Local Climatolog”.

No. it had the same faults as already mentioned. It looks like “strip_units” is referencing some php code that I don’t have?

drobbins,

I’ve got some help from friends on this one. I’m confused to why some with the carterlake templates have it working fine and a couple of people are having issues. I will let you know when I’ve figured this out. Sorry. :oops:

Michael

This function is in my dashboard…

// strip trailing units from a measurement
// i.e. '30.01 in. Hg' becomes '30.01'
function strip_units ($data) {
  preg_match('/([\d\.\+\-]+)/',$data,$t);
  return $t[1];
}

I think this might be what is needed?

Jack

Are you sure all of the required tags are in the testtags.php file?
If a tag is missing, the function strip_units that is in the function gen_difference will fail.

Hi Michael,
i have the same issue of Jack,
It should be this function

<?php echo [b]gen_difference[/b]($avtempjannow, $avtempjan, $uomTemp,
		  	  '%s'.$uomTemp.' Warmer than All-Time Average Temperature.',
   			'%s'.$uomTemp.' Colder than All-Time Average Temperature.'); ?>

on line 71

I know that i have an error in my ajax dashboard but i believe that it should interfere with this issue.
Many thanks,

Alessandro

I’ll throw my hat in the ring of those who installed the script but getting same error as those already awaiting an answer.

I absolutely verified all 24 tags in testtags.txt and they were already. So I shall await the final verdict.

Thanks for sharing, I will add this to my site tonight.

I have the same problem that some others also is having.

I get this error.

Fatal error: Call to undefined function gen_difference()

hi
I too am getting the same error, I know nothing about coding but a thought occured to me, I am using the “Alterative ajax-Dashboard” rather than the original which one are others with the same issue using? Could it be something to do with which version your using?
Phil

Yes :slight_smile:

//=========================================================================
// strip trailing units from a measurement
// i.e. '30.01 in. Hg' becomes '30.01'
function strip_units ($data) {
  preg_match('/([\d\.\+\-]+)/',$data,$t);
  return $t[1];
}


//=========================================================================
//  generate an up/down arrow to show differences

function gen_difference( $nowTemp, $yesterTemp, $Legend, $textUP, $textDN) {
  global $imagesDir;
  $diff = round(strip_units($nowTemp) - strip_units($yesterTemp),2);
  $absDiff = abs($diff);
  $diffStr = sprintf("%01.0f",$diff);
  $absDiffStr = sprintf("%01.0f",$absDiff);
  if ($diff == 0) {
 // no change

$image = '&nbsp;'; 
  
  } elseif ($diff > 0) {
// today is greater 
$msg = sprintf($textUP,$absDiff); 
$image = "<img src=\"${imagesDir}rising.gif\" alt=\"$msg\" title=\"$msg\" width=\"7\" height=\"8\" style=\"border: 0; margin: 1px 3px;\" />";

  
  } else {
// today is lesser
$msg = sprintf($textDN,$absDiff); 
$image = "<img src=\"${imagesDir}falling.gif\" alt=\"$msg\" title=\"$msg\" width=\"7\" height=\"8\" style=\"border: 0; margin: 1px 3px;\" />";
   
  }
   if ($Legend) {
       return ($diff . $Legend . $image);
	} else {
	   return $image;
	}
}


Pinto
The code in the above post, what should I do with it?
Phil

Put it before the closing-tag at the bottom of the Wxglobalwarming.php

so before ?>

Thanks Pinto, now it’s working

Yes thanks pinto got it working http://www.weybourneweather.co.uk/wxglobalwarming.php Just got to add the page to the menu. :slight_smile:

I was to quick :(, I don’t get any figures in the last column.

What could be wrong?

since I can’t see your page or your code I can only guess:

last column needs function gen_difference and that function needs function strip_units

so my guess is you don’t have one of them or you have one of them twice

Sorry, here is my code.

<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (WD-USA template set)
############################################################################
#
#   Project:    Sample Included Website Design
#   Module:     sample.php
#   Purpose:    Sample Page
#   Authors:    Kevin W. Reed <[email protected]>
#               TNET Services, Inc.
#
# 	Copyright:	(c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#	This document uses Tab 4 Settings
############################################################################
require_once("Settings.php");
require_once("common.php");
############################################################################
$TITLE= $SITE['organ'] . " - Annual Departure from Average";
$showGizmo = true;  // set to false to exclude the gizmo
include("top.php");
############################################################################
?>
</head>
<body>
<div id="main-copy">

<center><h3>Global Warming Trending for Axelvold, Sk

Can’t find where it goes wrong, but here is mine.

hope this helps :slight_smile:

Jozef