category
* and sections:
* category
* with each section being an 'unordered list' of links:
*
link
* description
*
* It is not necessary to sort the links file beforehand.
*/
$links=file("links.txt");
for ($line=0; $line < count($links); $line++) {
$current=trim($links[$line]);
// category, url, name, description
list($l_c,$l_u,$l_n,$l_d)=explode("|",$current);
$cats[$line]="$l_c";
$links[$line]=$current;
}
sort($cats);
reset($cats);
/* take only 1 of each category for the anchor tags */
$cats_u=array_unique($cats);
sort($cats_u);
reset($cats_u);
sort($links);
reset($links);
if ($debug=="on"){
for ($count=0; $count < count($cats); $count++){
echo "
cats[$count]= $cats[$count]\n";
}
for ($count=0; $count < count($cats_u); $count++){
echo "
cats_u[$count]= $cats_u[$count]\n";
}
}
$_head=" Top
\n";
for ($cnt=0; $cntcats_u[$cnt]=$cats_u[$cnt] \n";
}
// not pretty, but it's the best place i've found to close the s
if ($cnt>0){
$_body[$cnt]="
\n";
} else {
$_body[$cnt]="";
}
$_head .= " $cats_u[$cnt] \n";
$_body[$cnt].= " \n [back to Top]\n";
$_body[$cnt].= " \n";
}
for ($count=0; $count$l_n";
if ($l_d != ""){
$_body[$cnt] .= "
\n $l_d";
}
$_body[$cnt] .= "\n \n";
}
}
}
echo " \n";
echo $_head;
echo "
\n";
for ($count=0; $count, so fix it here */
echo "
\n";
?>