PHP Classes
Icontem

File: breadCrumbs.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tofeeq ur Rehman  >  Bread crumbs  >  breadCrumbs.php  
File: breadCrumbs.php
Role: Class source
Content type: text/plain
Description: generate breadcrumbs for seo sites
Class: Bread crumbs
Generate breadcrumb links from page URI
 

Contents

Class file image Download
<?php
/*
@Taufeeq ur Rehman
@Sat Feb 16 11:52:10 PST 2008 11:52:10
@Class:breadcrumbs to keep track of what user has been visited.
@A facility which will show the customer what steps they have 
    taken to get to their current location
*/
class breadCrumbs{
    var 
$site_root;
    var 
$site_name;
    var 
$css_class;
    
#constructor
    
function breadCrumbs($site_root,$site_name,$css_class){
        
$this->site_root $site_root;
        
$this->site_name $site_name;
        
$this->css_class $css_class;
    }
    
#~desctructor
    
function _breadCrumbs(){
        unset(
$this->site_root,$this->site_name,$this->css_class);
    }
    
    function 
getBreadCrumbs(){
        if(
strpos($_SERVER['REQUEST_URI'],".php"))return false;
        if(
$this->site_name != '/')
            
$uri str_replace("/".$this->site_name."/","",$_SERVER['REQUEST_URI']);
        else
            
$uri ltrim($_SERVER['REQUEST_URI'],"/");
        
        
$uri split("\?",$uri);
        
$args $uri[1];
        
$uri $uri[0];    
        
        
$pos strpos($uri,".html");
        
$slash="";
        if(
substr($uri,strlen($uri)-1,strlen($uri)) == '/')
        
$slash '/';
        
        
$uri explode("/",rtrim($uri,"/"));
        
//echo '<p><pre>'; var_export($uri);echo '</pre></p>';
        
$url '<a class="'.$this->css_class.'" href="'.$this->site_root.'">Home</a> > ';
        
$href "";
        for(
$i=0$i<count($uri); $i++){
            
$s "";
            if(
$i == (count($uri)-1)) $s $slash;
            else if((
strpos($uri[$i+1],".html") === false)) $s '/';
            if(
strpos($uri[$i],".html") !== false$href.="/";
            
$href.=$uri[$i].$s;
            
$url.= '<a href="'.$this->site_root.$href.'" class="'.$this->css_class.'">'.trim($uri[$i],"/").'</a> > ';
        }
        
$url substr($url,0,(strlen($url)-3));
        return 
$url;
    }
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products