<?php
  /*
   * Erzeugt das 'Breadcrumbs'-Menü aus dem Pfad zur Seite und dem Seitentitel
   */
  function getBreadcrumbs($pagetitle) {
  	
		$breadcrumbs = '';
		$dirStr = dirname(substr(getHomePath($_SERVER['SCRIPT_FILENAME']), 1));
		$nodes = explode(SEPARATOR, $dirStr);		
		$len = count($nodes);
		
		// Link aus Verzeichnisnamen generieren
		if (($dirStr != '.') && (($dirStr != '\\'))) {
			for ($i = 0; $i < $len; $i++) {
				
				$breadcrumbs = $breadcrumbs.'<span class="bcSeparator"> &raquo;&nbsp;</span><a href="';
				
				if (($len - $i) > 1) {
					for ($j = ($len - $i); $j > 1; $j--) {
					//for ($j = 0; $j < ($len - ($i+1)); $j++) {
						$breadcrumbs = $breadcrumbs.UP_DIR;
					}
				}
				else {
					$breadcrumbs = $breadcrumbs."./";
				}
				
				$breadcrumbs = $breadcrumbs."\">".ucfirst($nodes[$i])."</a>";
			}
		}
		
		// Dokumententitel ans Ende der Breadcrumbs stellen
		if (($pagetitle != null) && ($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;
  }
  
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
<?php
	if ($pagetitle != null)
		print "\t\t<title>$pagetitle - tilman.de</title>\n";
	else
		print "\t\t<title>tilman.de</title>\n";
?>
		
		<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<?php
	if ($keywords != null) print "\t\t<meta name='keywords' content='$keywords' />\n";
	if ($description != null) print "\t\t<meta name='description' content='$description' />\n";
	print "\n\t\t<link rel='stylesheet' type='text/css' href='/stylesheet.css' media='all' />\n";
?>
	</head>
	
	<body>
    
		<div id="login" style="position: absolute; top: 1ex; right: 1ex; font-size: x-small;">		
			<?php 
				if (sessionRunning() & ($_SERVER['PHP_SELF'] != '/logout.php')) {
					echo ucfirst($_SESSION['user']).'<br />';
					echo '<a href="/logout.php">abmelden</a>';
				}
				else {
					echo '<a href="/login.php">anmelden</a>';
				}
			?>
		</div>
		
		<div id="pagetitle">
			<div class="headline">
				<a href="/">tilman.de</a>
				<span class="breadcrumbs"><?php echo getBreadcrumbs($breadcrumb); ?></span>
			</div>
			<div style="margin: 8px; padding: 0ex; border-top: 1px solid #AA0000;"></div>
		</div>
		