File: /home/awaldron/public_html/archive/demo/_breadcrumb.php
<?php
function breadcrumb($id,$type=1) {
$ctr = 0;
if (isset($GLOBALS["breadcrumb"])) {
return $GLOBALS["breadcrumb"];
}
if (strstr(self(),"directory.php")) {
return "<a href=\"/content.php?p=1\">Intranet Home</a> > Employee Directory";
} else {
if (isset($GLOBALS["ext_page"])) { $bc[$ctr] = "xx||".$GLOBALS["ext_page"]; $ctr++; }
if (strstr(self(),"notice_add.php")) { $bc[$ctr] = "xx||"."Add a Notice"; $ctr++; }
if (strstr(self(),"notice_edit.php")) { $bc[$ctr] = "xx||"."Edit Notice"; $ctr++; }
if (strstr(self(),"content_edit.php")) { $bc[$ctr] = "xx||"."Edit Page Content"; $ctr++; }
if (strstr(self(),"content_add.php")) { $bc[$ctr] = "xx||"."Add A Sub-Page"; $ctr++; }
if (strstr(self(),"thread_add.php")) { $bc[$ctr] = "xx||"."Add Message to Thread"; $ctr++; }
if (strstr(self(),"thread_edit.php")) {
$bc[$ctr] = "xx||"."Edit Thread Message"; $ctr++;
$id = quickSQL("SELECT notice_id FROM tbl_threads WHERE thread_id=".$id);
}
if (($type > 2) && ($type != 4) && ($type != 6) && ($type != 7) && ($type < 10)) {
$sql = "SELECT * FROM tbl_notices WHERE notice_id=".$id;
$result = mysql_query($sql);
$crumb = mysql_fetch_array($result);
$bc[$ctr] = "/notice.php?nid=".$crumb["notice_id"]."||".substr($crumb["notice_headline"],0,37).(strlen($crumb["notice_headline"])>37?"...":"");
$id = $crumb["notice_type_id"];
$ctr++;
}
if (($type > 1) && ($type != 6) && ($type != 7) && ($type < 10)) {
$sql = "SELECT * FROM tbl_notice_types WHERE notice_type_id=".$id;
$result = mysql_query($sql);
$crumb = mysql_fetch_array($result);
$bc[$ctr] = "/noticeboard.php?ntid=".$crumb["notice_type_id"]."||".$crumb["notice_type_name"];
$id = $crumb["parent_id"];
$ctr++;
}
while ($id != 0) {
$sql = "SELECT page_id, parent_id, page_title FROM tbl_pages WHERE page_id=".$id;
$result = mysql_query($sql);
$crumb = mysql_fetch_array($result);
$bc[$ctr] = "/content.php?p=".$crumb["page_id"]."||".$crumb["page_title"];
$id = $crumb["parent_id"];
$ctr++;
}
//echo print_r($bc)."<BR>".count($bc)."<BR>";
$breadcrumb = "<a href=\"/content.php?p=1\">Intranet Home</a>";
for ($i=count($bc); $i > 1; $i--) {
$sub = $i-2;
$link = explode("||",$bc[$sub]);
if ($sub == 0) {
$breadcrumb .= " > ".$link[1]."\n";
} else {
$breadcrumb .= " > <a href=\"".$link[0]."\">".$link[1]."</a>\n";
}
}
return $breadcrumb;
}
}
if (strstr(self(),"notice.php")) echo breadcrumb($_GET["nid"],3);
else echo breadcrumb($_GET["p"]);
?>