Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » Custom Breadcrumbs fatal error

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

Page: 1
Go to End
Author Topic: 878 Views
  • liece
    Avatar
    Community Member
    9 Posts

    Custom Breadcrumbs fatal error Link to this post

    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....

    878 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.