[eluser]Lykos22[/eluser]
[quote author="JoostV" date="1402910833"]
If you generate breadcrumbs based on data from multiple tables (such as posts, or pages) then I would use a library. Something like
Code:
class breadcrumbs
{
protected $breadcrumbs = array();
public function getBreadcrumbs ()
{
return $this->breadcrumbs;
}
public function add ($breadcrumb)
{
$this->breadcrumbs[] = $breadcrumb;
return $this;
}
}
This way you could do stuff like
Code:
$this->load->library('breadcrumbs');
$this->breadcrumbs->add(anchor('/', 'Home'));
Because the add method returns the library itself you can also use chaining:
Code:
$this->load->library('breadcrumbs');
$this->breadcrumbs->add(anchor('/', 'Home'))->add(anchor('about-us', 'About Us'));
[/quote]
Yes that's what I was trying to say
breadcrumbs based on data from multiple tables (such as posts, or pages)
So basicly this library does not interact with the database on its own, you set the breadcrumbs manualy on your controller or view, right? and how do you set the html layout then? what I mean is how do you generate this
Code:
<ol class="breadcrumb">
<li><a href="#">Home</a></li>
<li><a href="#">Library</a></li>
<li class="active">Data</li>
</ol>