Invalid Category";
} else {
// ======================================================================================
// | PRINT CATEGORY HIERARCHY TO THE CURRENT CATEGORY WITH LINKS |
// |____________________________________________________________________________________|
echo " \n";
// ======================================================================================
// | PRINT SUB-CATEGORIES, SYMBOLIC AND NARROW |
// |____________________________________________________________________________________|
if(!empty($narrow) || !empty($symbolic)) {
echo "Sub-Categories in " . $title . " ";
$query = "SELECT catID,title,numlinks FROM dmoz_category WHERE ";
if(!empty($narrow)) {
$query .= "catID IN ($narrow) ";
}
if(!empty($narrow) && !empty($symbolic)) {
$query .= "OR ";
}
if(!empty($symbolic)) {
$query .= "catID IN (";
$syms = explode("|", $symbolic);
for($i = 0; $i < sizeof($syms); $i++) {
$tmp = explode(":", $syms[$i]);
$symtmp[$tmp[0]] = $tmp[1];
$query .= $tmp[0];
if($i != sizeof($syms)-1) {
$query .= ",";
}
}
$query .= ")";
}
$result = mysql_query ($query) or die ("Invalid query".mysql_error());
$row_count = mysql_num_rows($result);
while($row = mysql_fetch_array($result)) {
if(isset($symtmp[$row["catID"]])) {
$categories[$symtmp[$row["catID"]]] = array($row["catID"],$row["numlinks"]);
} else {
$categories[$row["title"]] = array($row["catID"],$row["numlinks"]);
}
}
mysql_free_result($result);
ksort($categories);
$half = $idx = 0;
if($row_count > 1) {
$half = ceil($row_count/2);
}
echo "\n";
}
// ======================================================================================
// | PRINT LETERBAR FOR CATEGORIES WITH TOO MANY SUBCATEGORIES |
// |____________________________________________________________________________________|
if(!empty($letterbar)) {
echo "Index:\n";
echo "\n";
$lets = explode("|", $letterbar);
for($i = 0; $i < sizeof($lets); $i++) {
$tmp = explode(":", $lets[$i]);
$let[$tmp[0]] = $tmp[1];
}
ksort($let);
for (reset ($let); $key = key ($let); next ($let)) {
echo "$key\n";
}
echo "\n";
}
// ======================================================================================
// | PRINT LINKS, $pp PER PAGE |
// |____________________________________________________________________________________|
if(!isset($pp))
$pp = 50;
if(!isset($page))
$page = 1;
$query = "SELECT title,url,description,priority FROM dmoz_link WHERE catID=$catID ORDER BY priority DESC,title ASC";
$result = mysql_query ($query) or die ("Invalid query".mysql_error());
$total = mysql_num_rows($result);
if ($total > 0) {
$start = $endp = $pages = 0;
if(($page-1)*$pp > $total)
$page = 1;
if($total > $pp) {
$pages = ceil($total/$pp);
$start = (($page-1)*$pp)+1;
if($pp*$page < $total) {
$endp = $pp*$page;
} else {
$endp = $total;
}
}
echo " Web Sites in Category $title\n";
if($total > $pp)
print_pages($start,$endp,$total,$pages,$page,$catID,$pp);
echo " \n";
$currlink = 0;
while($row = mysql_fetch_array($result)) {
$currlink++;
if($total > $pp && ($currlink < $start || $currlink > $endp))
continue;
echo "" . $row["title"] . "";
if($row["priority"] == "1") {
echo " ";
}
if(!empty($row["description"]))
echo " - " . $row["description"] . "\n";
echo "
 \n";
}
if($total > $pp)
print_pages($start,$endp,$total,$pages,$page,$catID,$pp);
}
// ======================================================================================
// | PRINT RELATED CATEGORIES |
// |____________________________________________________________________________________|
if(!empty($related)) {
echo " Related Categories: \n";
echo "\n";
//$related = preg_replace("/\//", " > ", $related);
//$related = preg_replace("/_/", " ", $related);
$rel = explode("|", $related);
for($i = 0; $i < sizeof($rel); $i++) {
$tmp = explode(":", $rel[$i]);
$tmp[1] = substr($tmp[1], 4);
$tmp[1] = ereg_replace("/", " > ", $tmp[1]);
$tmp[1] = ereg_replace("_", " ", $tmp[1]);
echo "$tmp[1] \n";
}
echo "\n";
}
// ======================================================================================
// | PRINT NEWSGROUPS WITH LINKS TO GOOGLE |
// |____________________________________________________________________________________|
if(!empty($newsgroups)) {
echo " Related Newsgroups: \n";
$ng = explode("|", $newsgroups);
for($i = 0; $i < sizeof($ng); $i++) {
echo $ng[$i] . " ";
echo "Google \n";
}
}
// ======================================================================================
// | PRINT THE EDITORS FOR THIS CATEGORY |
// |____________________________________________________________________________________|
if(!empty($editors)) {
echo " Editors:\n";
$ed = explode("|", $editors);
for($i = 0; $i < sizeof($ed); $i++) {
echo "" . $ed[$i] . "\n";
}
echo " \n";
}
echo "\n";
}
?>
|