Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

ajaz gizmo ?

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

ajaz gizmo ?

Post by n9mfk »

Hi All, i need some help with a project
in line 314 of CU-defs.php i added

Code: Select all

$today = date('n,j');
	$section = file('NoaaHistoryClimateData.csv');
	
	//variable names
	$WUmaxtempr =0;
	$WUmaxtempryr =0;
	$WUmintempr =0;
	$WUmintempryr =0;
	$WUmaxtemp =0;
	$WUmintemp =0;

	foreach($section as $date){
		// find month
		$data = explode(",",$date);
		
		if($today == ($data[0].",".$data[1])){
			$WUmaxtempr =$data[2];
			$WUmaxtempryr =$data[3];
			$WUmintempr =$data[4];
			$WUmintempryr =$data[5];
			$WUmaxtemp =$data[6];
			$WUmintemp =$data[7];
		} 
	}

Code: Select all

here are the error

Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\CU-defs.php on line 460 Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\CU-defs.php on line 460 Notice: Undefined offset: 1 in C:\c_n9mfk\www\test\CU-defs.php on line 462
Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\ajax-gizmo.php on line 391 Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\ajax-gizmo.php on line 392 Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\ajax-gizmo.php on line 392 Notice: Undefined offset: 1 in C:\c_n9mfk\www\test\ajax-gizmo.php on line 394

it happens on the 2 reload of the page i nit sure what i need to fix to clear the problem
http://99.37.55.171/test/
thanks Beau
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: ajaz gizmo ?

Post by saratogaWX »

Each of the Notice: errata shown like
Notice: Undefined offset: 2 in C:\c_n9mfk\www\test\CU-defs.php on line 460
simply shows that the [2] item in the array was missing (in the example above).

You have to look at line 460 in your source and examine the variable with a [2] in it, then determine how the [2] variable was set (a prior explode() that failed to produce the results expected). Then trace back the data to the source file to see why it is not set.

Using isset($variablename[2]) as a conditional to avoid using the variable if it's contents are undefined is highly recommended.

BTW.. by changing the CU-defs.php, you've adopted your own version for future support ... it is one of the files that is expected to be just replaced when using the updates page
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: ajaz gizmo ?

Post by n9mfk »

Ken,
i need to use CU_getAlltimeDate(
How could i have one file with all my code an put it together so it all works as one ?
Thanks Beau
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: ajaz gizmo ?

Post by saratogaWX »

Beau,

The CU_getAlltimeDate() function is internal to the CU-defs.php .. examples of usage appear at the start of the file .. feel free to use them as a guide. Other than a few comments in the code itself, there is no additional documentation available.

As for having a place for your developed code common to your site, I'd suggest that you not modify the -defs.php module, but instead create a new file like n9mfk-common.php with your code in it. Then modify top.php

Code: Select all

	include_once($SITE['WXtags']);
 }
to be

Code: Select all

	include_once($SITE['WXtags']);
	include_once("n9mfk-common.php");
 }
and your new common routines will be included at the proper place (and you won't interfere with the updates in the future).
Post Reply