# # Last Modified: Sunday, March 18, 2001 # # Website/Domain: http://dirs.educationcanada.com/ # # # # The Education Canada 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 258 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] : 258; // to the top level category $page = !empty($v1[2]) ? $v1[2] : 1; // to the top level category $pp = 50; include("$libdir/functions.inc"); // Include our global functions and variables $dbh = get_handle("ecn"); // 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 provID,title,hierarchy,levels,narrow,symbolic,related,editors,newsgroups,letterbar,numlinks FROM dmoz_category WHERE catID=$catID"; $result = mysql_query ($query) or die ("Invalid query"); $num_rows = mysql_num_rows($result); if(!empty($num_rows)) { list($provID,$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); ?> Canada 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 "
\"\"
\"\" $province Facts
\"\"
\"\"
\"\" Employers ($num_employers)
\"\"
\"\"
\"\" Job Postings ($num_jobs)
\"\"
\"\"
\"\" Events ($num_events)
\"\"

\n"; } ?>

 Search Directory

\n"; } ?>

 Browse Employers

Regions:

Alberta
British Columbia
Manitoba
New Brunswick
Nfld. and Labrador
Northwest Terr.
Nova Scotia
Nunavut
Ontario
Prince Edward Is.
Québec
Saskatchewan
Yukon

First Nations
National
International
New Employers

 Inside the ECN

About the ECN
Join the ECN
Help FAQ


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

/ ECN\n"; $lvl = explode("|", $levels); $lvl[0] = "Web Directory:258"; 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"); $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"); $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





Terms & Conditions of Use - Privacy Policy
Information for Job Seekers - Information for Employers - Information for Advertisers
Contact Us - Tech Support
1996-2008 Education Canada.