<?php
/*
This file is part of POOF.
POOF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
POOF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with POOF; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once(dirname(__FILE__) . "/../Hyperlinks.class.php");
/**
* A Bread Crumb Navigation Class.
* @package poof
* @subpackage Bread_Crumb
* @author Brian Takita <hide@address.com>
* @version 0.4
*/
class Bread_Crumb extends Hyperlinks {
/**
* The Bread Crumb constructor. It initializes the Bread Crumb queue. The default delimiter between Bread Crumbs is > .
*/
function Bread_Crumb() {
$this->Hyperlinks();
$this->delimiter = " > ";
}
/**
* Add a link into the Bread Crumb navigation.
*
* @param $title The displayed title name of the link.
* @param $url The url of the displayed link.
*/
function add($title, $url) {
parent::add($title, $url);
}
/**
* Parse the bread crumb into html.
* @return string The html for the Bread Crumb.
*/
function parse() {
$crumbs = &$this->_links;
$items = $crumbs->get_length();
$string = "";
for ($i=0; $i < $items-1; $i++) {
$content = &$crumbs->shift();
$string .= '<a href="' . $content['url'] . '">' . $content['title'] . '</a>'. $this->delimiter;
}
$content = &$crumbs->shift();
$string .= '<b>' . $content['title'] . '</b>';
return $string;
}
}
?>