Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Custom Breadcrumbs fatal error


Go to End
Reply


1143 Views

Avatar
liece

Community Member, 9 Posts

19 April 2011 at 8:41am

I'm new to SS and object-oriented coding...

been working SS advanced tutorial found on :
http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-2-using-model-admin-and-url-segments-to-create-a-product-catalogue/#PageComment_512

applied it, and it worked perfectly on my machine, untill I uploaded the website on the production server, and their I get this error when I try to view a category page:

Fatal error: Call to undefined method Page_Controller::breadcrumbs() in /home/master/public_html/beta/mysite/code/CategoryPage.php on line 86

the file in question CategoryPage.php is here below:



class CategoryPage_Controller extends Page_Controller
{
...

    //Generate out custom breadcrumbs
    public function Breadcrumbs() {

        //Get the default breadcrumbs
        $Breadcrumbs = parent::Breadcrumbs();

        if($Project = $this->getCurrentProject())
        {
            //Explode them into their individual parts
            $Parts = explode(SiteTree::$breadcrumbs_delimiter, $Breadcrumbs);

            //Count the parts
            $NumOfParts = count($Parts);

            //Change the last item to a link instead of just text
            $Parts[$NumOfParts-1] = ('<a href="' . $this->Link() . '">' . $Parts[$NumOfParts-1] . '</a>');

            //Add our extra piece on the end
            $Parts[$NumOfParts] = $Project->Title;

            //Return the imploded array
            $Breadcrumbs = implode(SiteTree::$breadcrumbs_delimiter, $Parts);
        }

        return $Breadcrumbs;
    }
    //hides the "show" from the url
    public static $url_handlers = array('$ID!' => 'show');
    
}

I don't know what could be the issue, it probably should be related to the server's configuration, I can't see anything else because I got it from this great tutorial, and it works locally....