100 ) { $file=""; } # Stop huge strings breaking it. } $flag=0; $z=0; $n= count ($list); while ($z<$n) { if ( preg_match("/[\.][pP][nN][gG]$/", $list[$z]) || preg_match("/[\.][gG][iI][fF]$/", $list[$z]) || preg_match("/[\.][jJ][pP][gG]$/", $list[$z]) ) { # Allow png, gif and jpg files $listnew[]=$list[$z]; if ($file == $list[$z]) { $flag=$flag+1;} } $z=$z+1; } $list=$listnew; if ($flag == 1) { # great, found the requested image in the list } else { # Didn't find it, so show all list. $file=""; } ?> <? print $titleText; ?>
\n"; print "

List of all ".count ($list)." example plots

\n"; print "\n \n"; $z=0; $n= count ($list); while ($z<$n) { print " \n"; if (($z+1)/2 == floor (($z+1)/2) ) { print " \n \n"; } $z=$z+1; } print " \n
".$list[$z]."
\n"; # print "\n"; } else { # plot graph $key=array_search($file,$list); $key=(int)$key; if ($key == ((int) count ($list) - 1) ) { $nextfile=$list[0]; # at end, go to start... } else { $nextfile=$list[$key+1]; } if ($key == 0) { $prevfile=$list[(int) count ($list) -1]; # at start, go to end } else { $prevfile=$list[$key-1]; } $fileP = substr($file, 0, 40); $nextfileP = substr($nextfile, 0, 40); $prevfileP = substr($prevfile, 0, 40); print "

List of all ".count ($list)." example plots

\n"; print "\n \n \n \n \n \n"; print " \n \n \n
"; print "".$prevfileP.""; print ""; print "(".($key+1)." of ".count ($list).")
"; print "".$fileP.""; print "
"; print "".$nextfileP.""; print "
"; print " "; print "
\n"; } #print_r ($list)."
\n"; ?>