magento的breadcrumbs是一个不错的功能,让自己制作新的模板的时候,也需要添加上breadcrumbs,增加更好的客户体验,magento的breadcrumbs机制,是一个很好的功能,扩展起来也是非常的方便,只要在您新的模块的controller对应的actions方法添加上就可以。,下面是一个例子:

$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( 'country' , array ( 'label' => 'Country' , 'title' => 'All Countries' , 'link' => 'http://example.com/magento/moduleName/country' ));
 
$breadcrumbs ->addCrumb( 'manufacturer' , array ( 'label' => 'State' , 'title' => 'States' ));
改代码要写在$this->loadLayout();之后,$this->renderLayout();之前
让您想在其他地方显示,可以使用下面的代码输出breadcrumbs
 
echo $this ->getLayout()->getBlock( 'breadcrumbs' )->toHtml();
祝您使用愉快!!