# # Website/Domain: http://dirs.educationamerica.net/ # # # # The Education America Web Directory consists of all DMOZ data under the # # Regional/North_America/Canada category. This script retrieves and displays # # data for the category specified in $catID. If no category ID is specified, # # it will return category 257 which is the top level for our data. # # # ############################################################################## $libdir = "../phplib"; // Local Include Directory // If there are more than 50 links in a category, this function is called // to display previous and next links to navigate through the pages of links function print_pages($start,$endp,$total,$pages,$page,$catID,$pp) { echo "
Displaying: $start – $endp ($total total)   "; if($page > 1) echo "<< Previous Page\n"; if($page > 1 && $page < $pages) echo " | "; if($page < $pages) echo "Next Page >>\n"; echo "\n"; } $v1 = explode("/",$PATH_INFO); // If no category ID has been specified then default $catID = !empty($v1[1]) ? $v1[1] : 257; // to the top level category $page = !empty($v1[2]) ? $v1[2] : 1; // to the top level category $pp = 50; // Sites per page include("$libdir/functions.inc"); // Include our global functions and variables $dbh = get_handle("ean"); // Get a persistant handle to our MySQL database ecndirs // Select and retrieve the data we have on the category whose ID is stored in $catID $query = "SELECT stateID,title,hierarchy,levels,narrow,symbolic,related,editors,newsgroups,letterbar,numlinks FROM dmoz_category WHERE catID=$catID"; $result = mysql_query ($query) or die ("Invalid query".mysql_error()); $num_rows = mysql_num_rows($result); if(!empty($num_rows)) { list($stateID,$title,$hierarchy,$levels,$narrow,$symbolic,$related, $editors,$newsgroups,$letterbar,$numlinks) = mysql_fetch_row($result); $row = mysql_fetch_array($result); $cat = "Regional/North_America/Canada".substr($hierarchy,3); } mysql_free_result($result); ?> United States Web Directory: <?php echo $title; ?>


\"\"

 Facts and Links

\"\" \"\"
\"\"
"; // If there are employers in this province then print a link with the number if($num_employers > 0) { echo ""; } // If there are jobs in this province then print a link with the number if($num_jobs > 0) { echo ""; } // If there are events in this province then print a link with the number if($num_events > 0) { echo ""; } echo "
\"\"
\"\" $state Facts
\"\"
\"\"
\"\" Employers ($num_employers)
\"\"
\"\"
\"\" Job Postings ($num_jobs)
\"\"
\"\"
\"\" Events ($num_events)
\"\"

\n"; } ?>

 Search Directory

\n"; } ?>

 Browse Directory


 Browse Employers


 Inside the USJ

About the USJ
Join the USJ as an employer
Help / FAQ

Invalid Category"; } else { // ====================================================================================== // | PRINT CATEGORY HIERARCHY TO THE CURRENT CATEGORY WITH LINKS | // |____________________________________________________________________________________| echo "
\"\"
\"\"

/ USJ\n"; $lvl = explode("|", $levels); $lvl[0] = "Web Directory:257"; for($i = 0; $i < sizeof($lvl); $i++) { $tmp = explode(":", $lvl[$i]); echo " / "; if($i != sizeof($lvl)-1) { echo "$tmp[0]"; } else { echo "$tmp[0]"; } } echo "   ($numlinks)

\"\"
\"\"

\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"; for (reset ($categories); $key = key ($categories); next ($categories)) { $idx++; echo " "; echo "$key"; if(isset($symtmp[$categories[$key][0]])) { echo "@"; } echo " (" . $categories[$key][1] . ")
\n"; if(!empty($half) && $idx == $half) { echo "\n

\n"; } } 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"; } ?>

Help build the largest human-edited directory on the web.

Submit a Site - Open Directory Project - Become an Editor



About USJ   |   Terms & Conditions of Use   |   Privacy Policy  |   Opportunities with USJ Information for Job Seekers   |   Information for Employers   |   Information for Advertisers Contact Us   |   Tech Support
Site and Contents © 2000-2006 Education America Network. All Rights Reserved.

  

HACKER SAFE certified sites prevent over 99.9% of hacker crime.