i have this class
<?php
ob_start();
session_start();
include 'db_con.php';
/**
*
* @Create Breadcrumbs Trail.
*
* @copyright Copyright (C) 2008 PHPRO.ORG. All rights reserved.
*
* @version //autogentag//
*
* @license new bsd http://www.opensource.org/licenses/bsd-license.php
*
* @filesource
*
* @package Breadcrumbs
*
* @Author Kevin Waterson
*
*/
class breadcrumbs{
/*
* @string $breadcrumbs
*/
public $breadcrumbs;
/*
* @string $pointer
*/
private $pointer = '»';
/*
* @string $url
*/
private $url;
/*
* @array $parts
*/
private $parts;
/*
* @constructor - duh
*
* @access public
*
*/
public function __construct()
{
$this->setParts();
$this->setURL();
$this->breadcrumbs = '<a class="bc" href="'.$this->url.'"><img src="http://'.$_SERVER['HTTP_HOST'].'/images/home.png" style="vertical-align:middle;" /></a>';
}
/*
*
* @set the base url
*
* @access private
*
*/
private function setURL()
{
$protocol = $_SERVER["SERVER_PROTOCOL"]=='HTTP/1.1' ? 'http' : 'https';
$this->url = $protocol.'://'.$_SERVER['HTTP_HOST'];
}
/*
* @set the pointer
*
* @access public
*
* @param string $pointer
*
*/
public function setPointer($pointer)
{
$this->pointer = $pointer;
}
/**
*
* @set the path array
*
* @access private
*
* @return array
*
*/
private function setParts()
{
$parts = explode('/', $_SERVER['REQUEST_URI']);
array_pop($parts);
array_shift($parts);
$this->parts = $parts;
}
/**
*
* @create the breadcrumbs
*
* @access public
*
*/
public function crumbs()
{
foreach($this->parts as $part)
{
if ($part=='login') {
$this->url .= "/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">'.strtoupper(str_replace($repl, ' ', $part)).'</a>';
} else if ($part=='contact') {
$this->url .= "/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">'.strtoupper(str_replace($repl, ' ', $part)).'</a>';
} else if ($part=='registration') {
$this->url .= "/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">INREGISTARE</a>';
} else if ($part!='jocuri') {
$this->url .= "/jocuri/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">'.strtoupper(str_replace($repl, ' ', $part)).'</a>';
} else if ($part!='user') {
$this->url .= "/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">'.strtoupper(str_replace($repl, ' ', $part)).'</a>';
}
}
}
} /*** end of class ***/
?>
and this that is two levels deep, i included the above class of course, to display
<?php
/*** a new breadcrumbs object ***/
$bc = new breadcrumbs;
/*** set the pointer if you like ***/
$bc->setPointer('<img src="../../images/bullet_arrows.png" style="vertical-align:middle;"/>');
/*** create the trail ***/
$bc->crumbs();
/*** output ***/
echo $bc->breadcrumbs;
the last code should remove the "USER" link from breadcrumbs, this code:
else if ($part!='user') {
$this->url .= "/$part";
$repl = array('_', '...');
$this->breadcrumbs .= " $this->pointer ".'<a class="bc" href="'.$this->url.'">'.strtoupper(str_replace($repl, ' ', $part)).'</a>';
}
but it doesn't work why?