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

MenuTitle instead of title in breadcrumbs


Go to End


3 Posts   1705 Views

Avatar
suntrop

Community Member, 141 Posts

28 May 2010 at 1:39am

I want to display in breadcrumbs the navigation links nstead the title of that page (all titles are pretty long and to navigate I prefer to use the navigation ;)

I found that in the archive: http://www.silverstripe.org/archive/show/31772
Unfortunately it doesn't work. i changed
SiteTree.php breadcumbs()

$parts[] = ("<a href=\"" . $page->Link() . "\">" . Convert::raw2xml($page->Title) . "</a>"); 

to
$parts[] = ("<a href=\"" . $page->Link() . "\">" . Convert::raw2xml($page->MenuTitle) . "</a>"); 

That post was 2 year old. Is there something new to v2.4 I have to change?

Avatar
Willr

Forum Moderator, 5523 Posts

29 May 2010 at 4:21pm

You should never edit anything in sapphire/ or cms/ (if you can avoid it) since it'll make upgrading annoying!

What you can do in the breadcrumbs case is copy the SiteTree::breadcrumbs() function to your Page.php file and customize it as much as you want!

Avatar
suntrop

Community Member, 141 Posts

30 May 2010 at 12:22am

Hi Willr. Thanks for that. I didn't thought of this way since I am not that familiar with OOP. But you are right, that is much better! And works.

Thanks!