<?php
/*
 * Created on 03.05.2005
 */
  
  define("SEPARATOR", "/");
  define("UP_DIR", "../");
  
  function getBreadcrumbs($filename, $pagetitle) {
  	
		$breadcrumbs = '';
		$dirStr = dirname(substr($filename, strlen($_SERVER["DOCUMENT_ROOT"])));
		$nodes = explode(SEPARATOR, $dirStr);		
		$len = count($nodes);
		
		for ($i = 1; $i < $len; $i++) {
			
			$breadcrumbs = $breadcrumbs."<span class=\"bcSeparator\"> &raquo;&nbsp;</span><a href=\"";
			
			if (($len - ($i+1)) > 0) {
				for ($j = 0; $j < ($len - ($i+1)); $j++) {
					$breadcrumbs = $breadcrumbs.UP_DIR;
				}
			}
			else {
				$breadcrumbs = $breadcrumbs."./";
			}
			
			$breadcrumbs = $breadcrumbs."\">".ucfirst($nodes[$i])."</a>";
		}
		
		if (!$pagetitle == "") {		
			/*$breadcrumbs = $breadcrumbs."<span class=\"bcSeparator\"> &raquo;&nbsp;</span><a href=\"";
			$breadcrumbs = $breadcrumbs.$dirStr.SEPARATOR.basename($filename);
			$breadcrumbs = $breadcrumbs."\">".$pagetitle."</a>";*/
			$breadcrumbs = $breadcrumbs."<span class=\"bcSeparator\"> &raquo;&nbsp;</span><span class=\"bcTitle\">".$pagetitle."</span>";
		}
		
		return $breadcrumbs;
  }
?>
