-
Notifications
You must be signed in to change notification settings - Fork 67
Open
ykws/Codeigniter-breadcrumbs
#2Description
When unshift a breadcrumb, the final result doesn't work fine.
Possible resolution:
// construct output
/*
foreach ($this->breadcrumbs as $key => $crumb) {
$keys = array_keys($this->breadcrumbs);
if (end($keys) == $key) {
$output .= $this->crumb_last_open . '' . $crumb['page'] . '' . $this->crumb_close;
} else {
$output .= $this->crumb_open.'<a href="' . $crumb['href'] . '">' . $crumb['page'] . '</a> '.$this->crumb_divider.$this->crumb_close;
}
}*/
// newer construct output
$num = count($this->breadcrumbs);
$i = 0;
foreach ($this->breadcrumbs as $key => $crumb) {
if (++$i === $num) {
$output .= $this->crumb_last_open . '' . $crumb['page'] . '' . $this->crumb_close;
} else {
$output .= $this->crumb_open.'<a href="' . $crumb['href'] . '">' . $crumb['page'] . '</a> '.$this->crumb_divider.$this->crumb_close;
}
}
Metadata
Metadata
Assignees
Labels
No labels