PHP Classes
elePHPant
Icontem

Breadcrumbs: Show directory and file path with links

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2004-04-30 (12 years ago) RSS 2.0 feedStarStarStarStar 64%Total: 4,234 All time: 676 This week: 1,109Down
Version License Categories
breadcrumb 1.0.0Unspecified (ask ...HTML, Files and Folders
Description Author

Please see http://www.baskettcase.com/classes/breadcrumb/ for description, details, and instructions.

Picture of Richard Baskett
Name: Richard Baskett <contact>
Classes: 1 package by
Country: United States United States

Details
File: $Id: class.breadcrumb.inc.php, 2004/04/30 00:56 PDT
-----------------------------------------------------------------------
Purpose of file: Show the directories and their links in path form
                 Home > Firstdir > Seconddir > Etc > filename.php
Information: If you use this script please contact me with a url or
             product information plus the product :) and please keep
             all header information intact. Cheers!
Pay-Pal info: paypal@baskettcase.com
-----------------------------------------------------------------------
@access public
@author Richard Baskett <rick@baskettcase.com>
@category directory structure
@copyright Copyright © 2004, Baskettcase Web Development
@example example.php
@link http://www.baskettcase.com/classes/breadcrumb/
@package breadcrumb
@version 2.4.2

SIMPLE EXAMPLE: (copy between the == lines and paste to your file
  between your php tags)
=======================================================================
<?php
 include_once('class.breadcrumb.inc.php');
 $breadcrumb = new breadcrumb;
 echo "<p>".$breadcrumb->show_breadcrumb()."</p>";
?>
=======================================================================

COMPLEX EXAMPLE: (copy between the == lines and paste to your file)
=======================================================================
<?php
 include_once('class.breadcrumb.inc.php');
 $breadcrumb = new breadcrumb;
 $breadcrumb->homepage='homepage'; // 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->special='elmer'; // special directory formatting
 $breadcrumb->changeName=array('dirname1'=>'Directory Name 1',
                               'dirname2'=>'Directory Name 2',
                               'dirname3'=>'Directory Name 3',
                               'dirname4'=>'Directory Name 4');
 $breadcrumb->changeFileName=array($_SERVER['PHP_SELF']=>'Example Page',
                                   '/index.htm'=>'Contact Us');
 $breadcrumb->fileExists=array('index.htm','index.php','default.htm');
 $breadcrumb->cssClass='crumb'; // css class to use
 $breadcrumb->target='_top'; // frame target
 $breadcrumb->linkFile=TRUE; // Link the file to itself
 $breadcrumb->_toSpace=TRUE; // converts underscores to spaces
 echo "<p>".$breadcrumb->show_breadcrumb()."</p>";
?>
=======================================================================

DEFINITIONS: (Not setting any of these variables will result in the
              DEFAULT settings)
              
-----------------------------------------------------------------------
GLOBAL OPTIONS
-----------------------------------------------------------------------
(homepage) sets the name of the home directory, leave empty if you do
   not want the home directory to show (DEFAULT = 'home')
-----------------------------------------------------------------------
(symbol) set the separator between directories (DEFAULT = ' > ')
-----------------------------------------------------------------------
(special) special directory formatting
   elmer = elmer fudd translation
   hacker = hacker speach translation
   pig = pig latin translation
   reverse = Reverses the text so it is backwards
   none = no special formatting (DEFAULT)
-----------------------------------------------------------------------
(cssClass) Use a css class to define the look of your breadcrumb.
  (DEFAULT = No css style
-----------------------------------------------------------------------
(_toSpace) Converts underscores '_' to a space in directory names.
  (DEFAULT = Keep underscores, no conversion
-----------------------------------------------------------------------
(target) set the frameset target value (DEFAULT '_self')
-----------------------------------------------------------------------

DIRECTORY OPTIONS
-----------------------------------------------------------------------
(dirformat) can be of type:
   ucwords = uppers case words (use with _toSpace)
   titlecase = upper case words except small words (the, is, with, etc)
   ucfirst = upper case first letter
   uppercase = all uppercase
   lowercase = all lowercase
   none = show directories as they are named in path structure (DEFAULT)
-----------------------------------------------------------------------
(imagedir) sets the image directory path, plus the image type. 
  (DEFAULT - Does not use images) You need to name your images the same
  as the actual directory names.
-----------------------------------------------------------------------
(changeName) Directory mapping/alias.  Alias your actual directory name
  to one of your choosing. For example if your actual directory
  structure is /temp/educ/science/bio/ you can map each directory name
  to /Temporary/Education/Science/Biology and display it as such.
  (DEFAULT = No aliasing, display the actual directory name)
-----------------------------------------------------------------------
(removeDirs) remove directories from the breadcrumb. So for example if
   your breadcrumb looked like this:
   home > classes > help > status > test.php
   Using this function you can hide/remove the directory to show this:
   home > classes > help > text.php
-----------------------------------------------------------------------
(unlinkCurrentDir) Remove the link to the current directory 
  (DEFAULT = FALSE)
-----------------------------------------------------------------------

FILE OPTIONS
-----------------------------------------------------------------------
(showfile) shows the file name in the path (DEFAULT = TRUE)
-----------------------------------------------------------------------
(fileExists) Link this directory only if one of the filenames exists
  Set your webservers default webpages that it checks for  when a 
  webpage has not been specified in the url.  So for example many 
  webservers look for a page called index.htm, index.html, index.php,
  default.htm, default.html, default.php.  Or you can use this variable 
  to just look for files you specify and link the directory if they
  exist.
  (DEFAULT = Link directories regardless of whether or not the
  directory has an index or default file)
-----------------------------------------------------------------------
(hideFileExt) hides the file extension (DEFAULT = FALSE)
-----------------------------------------------------------------------
(changeFileName) Filename mapping/alias.  Alias your file name to one 
  of your choosing. For example if your filename is example.php you can
  show it as 'Example Page'
  (DEFAULT = No aliasing
-----------------------------------------------------------------------
(linkFile) Links the file to itself (DEFAULT = FALSE)
-----------------------------------------------------------------------
  Files folder image Files  
File Role Description
Plain text file class.breadcrumb.inc.php Class Main class
Accessible without login Plain text file example.php Example Example File
Accessible without login HTML file README.htm Doc. How to Use the Class
Accessible without login Plain text file README.txt Doc. How to Use the Class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,234
This week:0
All time:676
This week:1,109Down
User Ratings User Comments (1)
 All time
Utility:81%StarStarStarStarStar
Consistency:78%StarStarStarStar
Documentation:82%StarStarStarStarStar
Examples:76%StarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:741
 
Nice, neat, useable.
5 years ago (Brandon Sussman)
80%StarStarStarStarStar