How to add Breadcrumb to my custom module

Normally when you redirect to any of the page in magento, from the top of the page you will get the breadcrumb of current page.
But in some times, when you implement custom module then you have to below code into your controller file. We may add into template files also.Once add above code and clear the cache and check.

public function indexAction() {
$this->loadLayout();
$breadcrumbs = $this->getLayout()->getBlock(‘breadcrumbs’);
$breadcrumbs->addCrumb(‘home’, array(‘label’=>Mage::helper(‘cms’)->__(‘Home’), ‘title’=>Mage::helper(‘cms’)->__(‘Home      Page’), ‘link’=>Mage::getBaseUrl()));
$breadcrumbs->addCrumb(‘mymodule_title’, array(‘label’=>$this->__(‘Module Title’), ‘title’=>$this->__(‘Module Title’), ‘link’=>”));
$this->renderLayout();
}

 

———————————————————————————————————————————————————————————————-

Corner of Blog:

“Plant a TREE … Go GREEN ….”

———————————————————————————————————————————————————————————————-