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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Customizing $Breadcrumbs


Go to End


13 Posts   15973 Views

Avatar
zenmonkey

Community Member, 545 Posts

1 December 2009 at 6:27am

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

Avatar
Willr

Forum Moderator, 5523 Posts

1 December 2009 at 7:42pm

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 :)

Avatar
tbarho

Community Member, 41 Posts

17 April 2010 at 3:59am

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 =)

Avatar
Juanitou

Community Member, 323 Posts

17 April 2010 at 7:48am

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.

Avatar
tbarho

Community Member, 41 Posts

23 April 2010 at 8:45am

Dev mode is already activated. still getting a blank page

Avatar
balder

Community Member, 14 Posts

19 August 2010 at 1:43am

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 :)

Avatar
Corry

Community Member, 17 Posts

23 February 2011 at 11:27pm

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?

Avatar
Willr

Forum Moderator, 5523 Posts

24 February 2011 at 8:40pm

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.

Go to Top