File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/mvc/models/m_breadcrump.php
<?php
/**
* m_breadcrump.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 2/18/13
*/
class Breadcrump
{
/*
* @property $crumps
*/
private $_crumps = array(); // array("crumpName" => "crumpLink");
/*
* Constructor
*/
public function constructor()
{
}
public function add($name, $link)
{
if($name != NULL && $link != NULL)
{
$this->_crumps[$name] = $link;
}
}
public function get()
{
$output = '';
$count = 1;
foreach($this->_crumps as $name => $url)
{
$output .= '<a href="'.$url.'"';
if($count == count($this->_crumps)) $output .= ' class="active"';
$output .= '>'.$name.'</a>';
if($count != count($this->_crumps)) $output .= '<span>/</span>';
$count++;
}
return $output;
}
public function getH1()
{
$output = '';
$count = 1;
foreach($this->_crumps as $name => $url)
{
if($count == count($this->_crumps)) $output .= '<h1>';
$output .= '<a href="'.$url.'"';
if($count == count($this->_crumps)) $output .= ' class="active"';
$output .= '>'.$name.'</a>';
if($count != count($this->_crumps)) $output .= '<span>/</span>';
if($count == count($this->_crumps)) $output .= '</h1>';
$count++;
}
return $output;
}
}