home *** CD-ROM | disk | FTP | other *** search
/ mcgregor.k12.mn.us / www.mcgregor.k12.mn.us.tar / www.mcgregor.k12.mn.us / crumbs.php < prev    next >
Text File  |  2010-09-07  |  1KB  |  45 lines

  1. <link href="style.css" rel="stylesheet" type="text/css" />
  2.  3<?php
  3.  
  4.  
  5. function breadCrumb($PATH_INFO) {
  6.     global $page_title, $root_url;
  7.  
  8.     // Remove these comments if you like, but only distribute 
  9.     // commented versions.
  10.     
  11.     // Replace all instances of _ with a space
  12.     $PATH_INFO = str_replace("_", " ", $PATH_INFO);
  13.     // split up the path at each slash
  14.     $pathArray = explode("/",$PATH_INFO);
  15.     
  16.     // Initialize variable and add link to home page
  17.     if(!isset($root_url)) { $root_url=""; }
  18.     $breadCrumbHTML = '<p></p><a href="'.$root_url.'/" title="Home Page" >Home</a>   ';
  19.     
  20.     // initialize newTrail
  21.     $newTrail = $root_url."/";
  22.     
  23.     // starting for loop at 1 to remove root
  24.     for($a=1;$a<count($pathArray)-1;$a++) {
  25.         // capitalize the first letter of each word in the section name
  26.         $crumbDisplayName = ucwords($pathArray[$a]);
  27.         // rebuild the navigation path
  28.         $newTrail .= $pathArray[$a].'/';
  29.         // build the HTML for the breadcrumb trail
  30.         $breadCrumbHTML .= '<a href="'.$newTrail.'">'.$crumbDisplayName.'</a class="LgBodyBold"> > ';
  31.     }
  32.     // Add the current page
  33.     if(!isset($page_title)) { $page_title = "Current Page"; }
  34.     $breadCrumbHTML .= '<p> <strong>'.$page_title.'</strong></p>';
  35.     
  36.     // print the generated HTML
  37.     print($breadCrumbHTML);
  38.     
  39.     // return success (not necessary, but maybe the 
  40.     // user wants to test its success?
  41.     return true;
  42. }
  43.  
  44. ?>
  45.