Using Breadcrumbs with cakePHP
<?php echo $html->getCrumbs(' > ','Home'); ?>
The first parameter of getCrumbs is the placeholder between two trail entries, which can be freely chosen. You can also replace “Home” with anything you like - this is going to be the first element of your breadcrumbs. And then second, add the specific bread crumbs to each view using this type of code:
<?php $html->addCrumb('Something', '/controller'); ?>
<?php $html->addCrumb('Something else', '/controller/method'); ?>
That’s it! You can add as many breadcrumbs to a view as you like - you also don’t have to worry about the location where you add the addCrumb call as it doesn’t matter. It just has to be somewhere in your view file. The navigation entries don’t have to belong to the same controller, so you can even combine different controllers and methods. There is only really one thing to notice: on your homepage where you usually only have the getCrumbs method called and no addCrumb call, there will be no breadcrumb trail shown! So don’t expect just a single “Home” or something to appear on the mainpage. Only “Home > First Entry” will be shown with additional crumbs added to your trail. If you want to have “Home” on your mainpage you can add an empty breadcrumb which will return “Home >”. I don’t think this is particularly nice, but have no better solution to offer at the moment. If you know a more elegant way of just displaying “Home” please let us know by commenting this entry!
If it was me, I would render the crumbs in an element or similar, then if no crumbs are set, just echo out a basic $html->link() instead
Granted it would be a fat element, as you would need to detect which controller you were in and add the correct crumb.
I guess you could just manually add a static $html->link to the /pages/home, or whatever you were using.