Jump to:

23355 Posts in 17702 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Customizing $Breadcrumbs

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 6850 Views
  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Customizing $Breadcrumbs Link to this post

    Is there an easy way to customize the output of the Breadcrumbs without editing core files. I know I can change the Delimiter but what if I want to output breadcrumbs as a list instead of a line? I could always jQuery it to look the way I want but that doesn't help for degradation.

    Perhaps later versions of SS could use a template file to render breadcrumbs much like rendering a menu

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: Customizing $Breadcrumbs Link to this post

    If you want to customize the HTML it returns currently the only way is to copy the Breadcrumbs function from SiteTree.php to your own Page.php. Then you can customize the function / output as much as you want

  • tbarho
    Avatar
    Community Member
    41 Posts

    Re: Customizing $Breadcrumbs Link to this post

    Hmm, when I try this, I just get a blank page. Any idea why? I've tried changing the method name to Crumbs, but it still gives me a blank page when I update my template to $Crumbs, so it seems that for some reason the method in the SiteTree class doesn't work in the Page class.

    Any thoughts would be helpful =)

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: Customizing $Breadcrumbs Link to this post

    Hi!

    >> Hmm, when I try this, I just get a blank page. Any idea why?

    Because you have an error in your code. Activate the dev mode and you will easily find it.

  • tbarho
    Avatar
    Community Member
    41 Posts

    Re: Customizing $Breadcrumbs Link to this post

    Dev mode is already activated. still getting a blank page

  • balder
    Avatar
    Community Member
    14 Posts

    Re: Customizing $Breadcrumbs Link to this post

    Tried to simply copy/paste the function $Breadcrumbs from SiteTree.php to Page.php in the "class Page extends SiteTree" section. I changed function name (and function calls in the templates) to $ModifiedBreadcrumbs, then modified "Title" with "MenuTitle": works like a charme and now i get proper menu labels in the breadcrumb

  • Corry
    Avatar
    Community Member
    17 Posts

    Re: Customizing $Breadcrumbs Link to this post

    Thanks for that. Works fine. Also had to add

    public static $breadcrumbs_delimiter = " » ";

    to the Page.php

    This issue has been raised a few times for over 3 years now. Why do the developers continue to make the Breadcrumbs function use page titles instead of the navigation label?

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: Customizing $Breadcrumbs Link to this post

    This issue has been raised a few times for over 3 years now. Why do the developers continue to make the Breadcrumbs function use page titles instead of the navigation label?

    Patches for that are welcome. It would be great it the Breadcrumbs function actually used a template file so that you could customize the entire thing in your theme.

    6850 Views
Page: 1 2
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.