Uninitialized string offset:
Posted: Mon Aug 09, 2010 10:56 pm
I keep getting an error:
PHP Notice: Uninitialized string offset: 7 in /home/reddingb/public_html/Instantleads/inc/isotope.php on line 14
PHP Notice: Uninitialized string offset: 6 in /home/reddingb/public_html/Instantleads/inc/isotope.php on line 14
Any ideas on what is wrong with the script to cause this?
Thanks for your help!!!
David
PHP Notice: Uninitialized string offset: 7 in /home/reddingb/public_html/Instantleads/inc/isotope.php on line 14
PHP Notice: Uninitialized string offset: 6 in /home/reddingb/public_html/Instantleads/inc/isotope.php on line 14
Any ideas on what is wrong with the script to cause this?
Code: Select all
<?php
function isotope_load($tr,$fn) {
$tn="__";
$sb="";
$f=fopen($fn,"r");
while(1) {
$l=fgets($f,1024);
if($l && $l[0]!='[') { $sb.=$l; continue; }
$s="";
while($sb) {
$i=strcspn($sb,'<');
if($sb[$i]!='<'||$sb[$i+1]!='=') {
$s.=substr($sb,0,$i+1);
$sb=substr($sb,$i+1);
if($sb) continue;
}
$s.=substr($sb,0,$i);
if(!array_key_exists($tn,$tr)) $tr[$tn]=array();
if($s) { array_push($tr[$tn],$s); $s=""; }
$sb=substr($sb,$i);
if(!$sb) break;
$i=strcspn($sb,'>')+1;
array_push($tr[$tn],substr($sb,0,$i));
$sb=substr($sb,$i);
}
if(!$l) break;
$i=strcspn($l,']');
$tn=substr($l,1,$i-1);
}
fclose($f);
return $tr;
}
function isotope_exec($tl, $tn, $vars) {
global $dbc;
$tr="";
if(!array_key_exists($tn,$tl)) return "";
foreach($tl[$tn] as $me) {
if($me[0]!='<' || $me[1]!='=') { $tr.=$me; continue; }
$n=substr($me,2); $n=substr($n,0,strcspn($n,'='));
if(array_key_exists($n,$vars)) $tr.=$vars[$n];
}
return $tr;
}
?>David