Skip to content

Instantly share code, notes, and snippets.

@dajare
Created September 8, 2013 21:18
Show Gist options
  • Save dajare/6488501 to your computer and use it in GitHub Desktop.
Save dajare/6488501 to your computer and use it in GitHub Desktop.
Converts the breadcrumbs code from Wolf CMS's default function for use with Bootstrap's breadcrumbs component
<ul class="breadcrumb">
<?php // for use with Twitter Bootstrap breadcrumbs component
$explode = explode("&raquo;</span>", $this->breadcrumbs('&raquo;'));
foreach ($explode as $key => $val) {
$val = preg_replace("/<span[^>]+\>/i", "", $val);
$val = str_replace("</span>", "", $val);
$pattern = '#<a href="(.+)" title="(.+)">#';
if (preg_match($pattern, $val, $breadcrumb) > 0) {
?>
<li><a href="<?php echo $breadcrumb[1]; ?>" title="<?php echo $breadcrumb[2]; ?>"><?php echo $breadcrumb[2]; ?></a> <span class="divider">/</span></li>
<?php
}
else {
?>
<li class="active"><a href="<?php echo $this->url(); ?>" title="<?php echo $val; ?>"><?php echo $val; ?></a></li>
<?php
}
} // credit: Tyler Beckett | http://www.wolfcms.org/wiki/howto:display_a_breadcrumb
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment