Crumbee: ExpressionEngine breadcrumbs plugin…
Just written my first EE plugin, appropriately named Crumbee, its pretty crummy really.
It basically grabs the url of the current page and builds a breadcrumb trail from that, replacing a “-” or a “_” with a space and capitalising the words. Very handy when using the EE pages module and/you/have/long/urls.
Some notes
- Extract, and upload the file to your system/plugin directory
- There is an exception list you can build within the plugin to override url outputs, for example the url /about/ will result in a hyperlink “About”, you can override this to become “About Us” if you wish. An example is in the plugin.
- To add the breadcrumbs, simply insert the following code to your template: {exp:crumbee delimiter="›"}
Full example would be:
<p> You are here: <a href="/">Home</a> › {exp:crumbee delimiter="›"} {title}</p> - The delimiter parameter allows you to specify what html entity you would like between the links...
Released freely, use at your own risk: pi.crumbee.zip
Credit to sillybean.net for giving me a great start in making this plugin.
28 comments…
By iain on December 09th 2008Great, hope you find it useful.
By Judd Lyon on February 08th 2009Thank you, this is quite handy, I’m using it on my blog.
By Phil Barbato on February 13th 2009Great simple plugin. This fills the gap left by the no-longer-supported Pages Crumbs plugin.
Thank you!
By Bob on March 05th 2009This plugin is exactly what I’ve been looking for except I cannot get it to work. Only the delimiter shows up and, once in a while, the words “About Us.”
By Eric on April 08th 2009Thank you for this easy to implement plugin, wonderful, works like a champ:)
By DUMB ASS SPAMMER on April 08th 2009Thanks for providing this great and useful plugins.I will let my friends to know about this for sure.
Shitty Web Site
Indian SpammerAlso, I’ll take some time to spam your site and you can screw up my links so they become irrelevant and a complete waste of time for everyone on the internets.
Thank you.
By Jake Mauer on April 14th 2009Thank you for this plugin, it’s exactly what I needed exactly when I needed it.
I appreciate your efforts immensely.
By Jake Mauer on April 14th 2009Hi Iain,
I’ve installed your plugin and it works great except that it inserts the delimiter before the first crumb. So it ends up being
> Home > Segment 1 > Segment 2
Any ideas why this could be happening?
I’m using EE 1.6.7 and the majority of my content are built using the pages module.
Thank you!
By iain on April 14th 2009ok, try this Jake,
replace:
$label = str_replace("-"," ",$label);
$crumblabel = str_replace("_"," ",$label);
$this->return_data .= " <a href=’/$url’>". ucwords($crumblabel) ."</a> ". $delimiter;with:
if ($dir != "index.php" AND $dir != "ANY_DIR_YOU_DONT_WANT" )
{
$label = str_replace("-"," ",$label);
$crumblabel = str_replace("_"," ",$label);
$this->return_data .= " <a href=’/$url’>". ucwords($crumblabel) ."</a> ". $delimiter;
}Just repeat the first line AND statement for any other directory’s you don’t want to be processed, eg:
if ($dir != "index.php" AND $dir != "ANY_DIR_YOU_DONT_WANT" AND $dir != "SOME_OTHER_DIR" )
make sense?
hope this helps, sorry about the lack of code colouring/formatting here.
Iain.
By Jake Mauer on April 14th 2009Thanks Iain, that was way faster than I expected!
While this does work in eliminating “home” from the breadcrumbs, I actually don’t mind having it there. If I wanted to keep it as
> Home > Segment 1 > Segment 2
but just remove the first ‘>’ how would I go about that?
Thanks again, I hope I’m not keeping you up.
By iain on April 14th 2009No probs Jake, its 3pm here in NZ.
I’d just use the example in the original blog post above, the home button isn’t really going to change, and if you wanted to change the delimiter you’d have to find all occurrences of the plugin in the templates anyway…
I normally hide the index.php with .htaccess which is why home appears for some folks using the plugin.
By Sam Oltz on May 06th 2009Iain,
I was experiencing issues with your plugin putting two delimiters in 1st level pages. Seems that $dir sometimes comes up empty and the script still tries to put the empty variable into the bread crumbs. I seem to have fixed it by modifying your suggestion to Jake above to this:
if ($dir != “index.php” && $dir != “") {
Thanks!
By Carlos Sant'Ana on June 02nd 2009Thanks for your wonderful plugin.
I installed it and it works, but in some pages I see {TITLE} in the last parameter.Does this only works for PAGES or also with dynamic content? I’m building an online store and wanted to include breadcrumbs to help navigation, but almost all my content is dynamic…
Best
Carlos
By iain on June 02nd 2009Hi Carlos.
If you want to use {title} you’ll need to place the plugin code within a {exp:weblog:entries} tag…
By Carlos Sant'Ana on June 02nd 2009Thanks for your quick answer.
Yur plugin is quite usefull...hope I can put it to work properly…
I copy pasted your proposed code and adapted it a bit to test.<div class="breadcrumb">[url=http://www.bebesdaterra.pt]http://www.bebesdaterra.pt[/url]{exp:crumbee delimiter="›"}{title}</div>
In this page http://bebesdaterra.br351.com/index.php/FAQ/quais_recomendamos it renders like this…
http://www.bebesdaterra.pt › FAQ › {title}
Any quicktip?
Thanks for your time…
Carlos
By Jim on June 23rd 2009Hi Iain,
I don’t know how to install the plugin. I thought I would copy the php file to system/modules/crumbee. I made a directory for crumbee and EE CP had a problem not finding the lauguage file.
I must be misunderstanding how to install this plugin. Any help is appreciated.Thanks,
Jim
By iain on June 23rd 2009Its a plugin Jim…
Drop the file into /system/plugins/ and you’ll be good to go.
By Jim on June 23rd 2009Thanks Iain! That did the trick.
-Jim
By Ben Schaaf on August 20th 2009I noticed that special characters are not displaying correctly.
http://sample.com/index.php/should-or-shouldn't/work/but/does/not/
The apostrophe shows up as the encoded value..but doesn’t de-encode.
Not sure if that makes sense.
By Ben Schaaf on August 20th 2009http://216.119.128.24/index.php/test/should-or-shouldn't/work/but/does/not/
my sample url got mangled in the quotes. hopefully you can figure it out.
By marygladies on November 04th 2009ExpressionEngine has the most compelling set of features of any publishing system on the market.
Thanks,
Wankers
By Russell on November 12th 2009I with you agree. In it something is. Now all became clear, I thank for the help and I hope to see more such articles.
By Sean on November 18th 2009Hello,
I’m setting this up on a current dev site now. It works fine except that when I try to implement the hack above to remove certain directorys. Once I do that those directories disappear however now the links don’t work correctly. Instead they refresh the page and add a new bread crumb which looks something like this:
› RASK › Events › �� ›
please advise. Below is the exact modification I made to the plugin file.
if ($dir != "site" && $dir != "cat" )
{
$label = str_replace("-"," ",$label);
$crumblabel = str_replace("_"," ",$label);
$this->return_data .= " <a href=’/$url’>". ucwords($crumblabel) ."</a> ". $delimiter;
}
By Sean on November 18th 2009just posted a comment, which isn’t showing up (moderation?) anyhow I foudn the problem.
On line 49 there are two single quotes ‘ which are actually curly quotes - change them and everything works.
By Jesse on January 29th 2010Hi Iain,
Thanks for this plugin!
I know there is a way to override the labels from the url, but is there a way to completely ignore a specific label in the url?
Thanks!
By Stuart Kirkland on February 18th 2010Hello Ian
I was wondering if you could help me im trying to display segment 1 in the crumb? how do i go about doing this?
By Magnus von Bromsen on April 20th 2010Hi
and thanks for this great plugin.One question: is it possible to have the last url segment shown in the breadcrum? Like this
Url: products/cars/wheel_x
Breadcrum: Products - Cars - Wheel X
Best Regards,
Magnus


