Documents
if ($handle = opendir(‘/home/rondoins/public_html/wp-content/uploads/documents’)) :
while (false !== ($file = readdir($handle))) :
if ($file != “.” && $file != “..”) :
$dir[] = $file;
endif;
endwhile;
closedir($handle);
sort($dir);
$head = “xyz-”;
foreach ((array)$dir as $key=>$val) :
$stripval = (substr($val,0,19)==”Ronstadt Insurance-” ? substr($val,19) : $val );
if ($stripval<>$val and $head<>substr($stripval,0,strlen($head))) :
$head = substr($stripval,0,strpos($stripval,”-”));
echo “
$head
\n”;
endif;
$stripval = (strstr($stripval,$head.”-”) ? str_replace($head.”-”,”",$stripval) : $stripval );
echo “
\n”;
endforeach;
endif;
?>