How to add breadcrumbs to magento CMS Homepage

Source: Internet
Author: User
How to add breadcrumbs2009-10-26 to magento CMS Homepage

Open code/CORE/MAGE/CMS/block/page. php and find the followingCodeAdd the code behind Else.

// Show breadcrumbs
If (Mage: getstoreconfig ('web/default/show_cms_breadcrumbs ')
& ($ Breadcrumbs = $ this-> getlayout ()-> getblock ('breadcrumbs '))
& ($ Page-> getidentifier ()! = Mage: getstoreconfig ('web/default/cms_home_page '))
& ($ Page-> getidentifier ()! = Mage: getstoreconfig ('web/default/cms_no_route '))){
$ Breadcrumbs-> addcrumb ('home', array ('label' => Mage: helper ('cm')->__ ('home '), 'title' => Mage: helper ('cms ')->__ ('go to home page'), 'link' => Mage: getbaseurl ()));
$ Breadcrumbs-> addcrumb ('cms _ page', array ('label' => $ page-> gettitle (), 'title' => $ page-> gettitle ()));
} Else {$ breadcrumbs-> addcrumb ('home', array ('label' => Mage: helper ('cm')->__ ('home '), 'title' => Mage: helper ('cms ')->__ ('go to home page'), 'link' => Mage: getbaseurl ()));
$ Breadcrumbs-> addcrumb ('cms _ page', array ('label' => $ page-> gettitle (), 'title' => $ page-> gettitle ()));
}

 

If you want to display breadcrumbs on a page without breadcrumbs by default, open breadcrumbs. phtml and add the following code:

<? PHP
/**
*
* Custom breadcrumbs
* By magentoex.com
*
* Adds URL breadcrumbs for pages that do not have breadcrumbs by default
*
*/?>
<? PHP if (is_null ($ crumbs):?>
<? PHP /**
* Note
* On Some servers use-> getserver ('path _ info ')
* And on some-> getserver ('orig _ path_info ')
*/$ URLRequest = Mage: APP ()-> getfrontcontroller ()-> getrequest ();
$ Urlpart = $ URLRequest-> getserver ('orig _ path_info '); If (is_null ($ urlpart ))
{
$ Urlpart = $ URLRequest-> getserver ('path _ info ');
} $ Urlpart = substr ($ urlpart, 1 );
$ Currenturl = $ this-> geturl ($ urlpart); $ controllername = Mage: APP ()-> getfrontcontroller ()-> getrequest ()-> getcontrollername ();
$ Controllername = ucfirst ($ controllername); $ controllername = str_replace ("/", "", $ urlpart );
$ Controllername = str_replace ("_", "", $ controllername );
$ Controllername = str_replace ("-", "", $ controllername );
$ Controllername = ucfirst ($ controllername);?> <Strong class = "no-display"> <? PHP echo $ this->__ ("you're currently on:")?> </Strong>
<Ul class = "Breadcrumbs">
<Li class = "home">
<A Title = "<? PHP echo $ this->__ ('go to home page')?> "Href =" <? PHP echo $ this-> geturl ()?> "> <? PHP echo $ this->__ ('home')?> </A>
</LI>
<Li>/</LI>
<Li class = "<? PHP echo strtolower ($ controllername)?> ">
<Strong> <? PHP echo $ this->__ ($ controllername)?> </Strong>
</LI>
</Ul> <? PHP endif;/* end of M breadcrumbs */?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.