I am using a code that someone linked me to from a library.
(breadcrumb.php)
<link href="/php/styles.css" rel="stylesheet" type="text/css">
<p class="body3"> </p>
<?php
#ini_set('display_errors', 'On');
// See class.breadcrumb.inc.php
('class.breadcrumb.inc.php');
$breadcrumb = new breadcrumb;
$breadcrumb->homepage='HOME'; // sets the home directory name
$breadcrumb->dirformat='ucfirst'; // Show the directory in this style
$breadcrumb->symbol=' > '; // set the separator between directories
$breadcrumb->showfile=TRUE; // shows the file name in the path
$breadcrumb->linkFile=TRUE; // Link the file to itself
$breadcrumb->_toSpace=TRUE; // converts underscores to spaces
$breadcrumb->hideFileExt=TRUE; //Hide the file extensions
echo "<p>".$breadcrumb->show_breadcrumb()."</p>";
?>
(class.breadcrumb.inc.php)
<?php
class breadcrumb {
// Directory Structure
var $scriptArray = '';
// Filename
var $fileName = '';
// Document Root
var $document_root = '';
// Homepage name
var $homepage = 'home';
// Directory type formatting
var $dirformat = '';
// Symbol to use between Directories
var $symbol = ' > ';
// CSS Class to use for each item
var $cssClass = '';
// Special Directory text style
var $special = '';
// Frameset target value default is '_self'
var $target = '';
// is this a personal site?
var $personalSite = '';
// Show the filename with the path
var $showfile = TRUE;
// Remove the link to the current directory
var $unlinkCurrentDir = FALSE;
// Hide the file Extension
var $hideFileExt = FALSE;
// Linke the filename to itself
var $linkFile = FALSE;
// Replace underscore with space
var $_toSpace = FALSE;
// Show errors
var $showErrors = FALSE;
// Where are the images kept and what type of images
var $imagedir = array();
// Change the Directory Names to something a bit more readable
var $changeName = array();
// Change the file name to something a bit more user friendly
var $changeFileName = array();
// If variable has a value check for that page if it exists link the directory
// otherwise just show the name of the directory.
var $fileExists = array();
// Remove a directory from the breadcrumb so that it does not show
var $removeDirs = array();
/**
function breadcrumb
@since Version 2.0.0
*/
function breadcrumb() {
// Creates an array of Directory Structure
$this->scriptArray = explode("/", $SERVER['PHP_SELF']);
// Pops the filename off the end and throws it into it's own variable
$this->fileName = array_pop($this->scriptArray);
// Is this a personal site?
if (substr($SERVER['PHP_SELF'], 1, 1)=='~') {
$tmp = explode('/', $SERVER['PHP_SELF']);
$this->personalSite = $tmp[1];
$this->document_root = str_replace(str_replace('/'.$this->personalSite, '', $SERVER["SCRIPT_NAME"]), '', $SERVER['PATH_TRANSLATED']);
}
else
$this->document_root = str_replace($SERVER["SCRIPT_NAME"], '', $SERVER['PATH_TRANSLATED']);
#echo $this->document_root.'<Br />';
#echo $SERVER["SCRIPT_NAME"].'<Br />';
#echo $_SERVER["PATH_TRANSLATED"].'<Br />';
}
/**
function str_split
@since Version 2.2.0
Converts a string to an array
/
function str_split($string) {
for ($i=0; $i<strlen($string); $i++) $array[] = $string{$i};
return $array;
}
/**
function specialLang
@since Version 2.0.0
Convert string into language specified
/
function specialLang($string, $lang) {
// parse Directory special text style
switch($lang) {
case 'elmer': $string = str_replace('l','w',$string);
$string = str_replace('r','w',$string);
break;
case 'hacker': $string = strtoupper($string);
$string = str_replace('A','4',$string);
$string = str_replace('C','(',$string);
$string = str_replace('D','D',$string);
$string = str_replace('E','3',$string);
$string = str_replace('F','ph',$string);
$string = str_replace('G','6',$string);
$string = str_replace('H','}{',$string);
$string = str_replace('I','1',$string);
$string = str_replace('M','|V|',$string);
$string = str_replace('N','|\|',$string);
$string = str_replace('O','0',$string);
$string = str_replace('R','R',$string);
$string = str_replace('S','5',$string);
$string = str_replace('T','7',$string);
break;
case 'pig': $vowels = array('a','A','e','E','i','I','o','O','u','U');
$string = $this->str_split($string);
$firstLetter = array_shift($string);
$string = implode('',$string);
$string = (in_array($firstLetter, $vowels))
? $firstLetter.$string.'yay'
: $string.$firstLetter.'ay';
break;
case 'reverse': $string = strrev($string);
break;
}
return $string;
}
/**
function dirFormat
@since Version 2.2.0
Convert string into specified format
/
function dirFormat($string, $format) {
// parse Directory text style
switch($format) {
case 'titlecase': $string = $this->titleCase($string); break;
case 'ucfirst': $string = ucfirst($string); break;
case 'ucwords': $string = $this->convertUnderScores($string);
$string = ucwords($string); break;
case 'uppercase': $string = strtoupper($string); break;
case 'lowercase': $string = strtolower($string); break;
default: $string = $string;
}
return $string;
}
/**
*/
function titleCase($text) {
$text = $this->convertUnderScores($text);
$min_word_len = 4;
$always_cap_first = TRUE;
$exclude = array('of','a','the ','and','an','or','nor','but','is','if',
'then','else','when','up','at','from','by','on','off',
'for','in','out','over','to','into','with','htm','html',
'php','phtml');
// Allows for the specification of the minimum length
// of characters each word must be in order to be capitalized
// Make sure words following punctuation are capitalized
$text = str_replace(array('(', '-', '.', '?', ',',':','[',';','!'),
array('( ', '- ', '. ', '? ', ', ',': ','[ ','; ','! '),
$text);
$words = explode (' ', strtolower($text));
$count = count($words);
$num = 0;
while ($num < $count) {
if (strlen($words[$num]) >= $min_word_len
&& array_search($words[$num], $exclude) === false)
$words[$num] = ucfirst($words[$num]);
$num++;
}
$text = implode(' ', $words);
$text = str_replace(
array('( ', '- ', '. ', '? ', ', ',': ','[ ','; ','! '),
array('(', '-', '.', '?', ',',':','[',';','!'), $text);
// Always capitalize first char if cap_first is true
if ($always_cap_first) {
if (ctype_alpha($text[0]) && ord($text[0]) <= ord('z')
&& ord($text[0]) > ord('Z'))
$text[0] = chr(ord($text[0]) - 32);
}
return $text;
}
Basically I want the breadcrumbs to detail the entire path showing all documents accessed. It seems like I need to build separate directory paths in order for that to work instead of storing all documents under one directory.
Also I wanted to use a non-system name instead of the actual directory name in the breadcrumbs. So for example if the files are in the PHP directory, can I call that something else (within the breadcrumbs) or do I need to actually rename the directory.