Breadcrumbs in ExpressionEngine
I'm working on a site and setting up breadcrumbs with ExpressionEngine. Since I'm not using the structure module which as I understand it has a plugin tag I had to figure out a way to do this myself. With a little google help I found a plugin called Crumbee which got me a large part of the way there.
I'm working on a site and setting up breadcrumbs with ExpressionEngine. Since I'm not using the structure module which as I understand it has a plugin tag I had to figure out a way to do this myself. With a little google help I found a plugin called Crumbee which got me a large part of the way there.
The problem was that I ended up with a lot of extra pieces in the breadcrumb including "site" (my renamed index.php), cat (Category URL Indicator) and a couple of template names. In the comments to the plugin there's a way to remove them. This worked, however there was a side effect in that now the links didn't work and when clicked refreshed the page and added a new gibberish link to the breadcrumb.
A little investigation later and I found that the plugin had a couple of single curly quotes on line 49. Replacing line 49 with the following fixed the problem:
$this->return_data .= " <a href='/$url'>". ucwords($crumblabel) ."</a> ". $delimiter;
After that I noticed that this plugin didn't pull out the last segment of the URL which I wanted displayed but with no link. Fortunately "@low":http://twitter.com/low has a way to pull the "last segment into an ExpressionEngine variable":http://loweblog.com/freelance/article/last-segment-a-global-variable/.
Then I discovered that this resulted in the last segment displaying with my url separator meaning that "This is a Blog Title" ended up being in the breadcrumb looking like this "this_is_a_breadcrumb" which I did not like. I searched for a find and replace plugin and Low to the rescue again with "EE Find and Replace":http://loweblog.com/freelance/article/pireplacephp/.
Yes everything looks fine except that Crumbee is adding the breadcrumb separator in front of the first crumb. Time to find a plugin to strip characters from the beginning which I remembered existed but could remember the name. In the end I found it - trimmer but in the process of looking I found JackMcDade's fabulous plugin URI Prettify which auto strips the url separator and automagically adds sentence case back to the segment.
Out with find and replace in with uri prettify. Now everything looks great. Find and Replace is still a great plugin and I know I'll use it again, but URI prettify is better for this particular job.
My final code is this:
{exp:trimmer left="25" }{exp:crumbee delimiter="›"}{/exp:trimmer} {exp:uri_prettify uncap_keywords="yes" keywords="a|is"}{last_segment}{/exp:uri_prettify}
hope this helps someone.