Extension talk:BreadCrumbs2

Header problem
When I enable this extension, I get an error about the headers already being sent by BreadCrumbs2.php from WebResponse.php (specifically Warning: Cannot modify header information - headers already sent by (output started at /xxxx/mediawiki-1.11.0/extensions/BreadCrumbs2.php:204) in /xxxx/mediawiki-1.11.0/includes/WebResponse.php on line 10.  Any hints as to how I might fix this? 129.21.126.84 03:32, 8 October 2007 (UTC)

Save your document (php) as plain text, not as utf encoded.


 * ok that did it, thanks 129.21.126.84 21:57, 8 October 2007 (UTC)

recharge
Well, I had the exact same problem, but the encoding was plain text: /etc/mediawiki/LocalSettings.php:              text/plain; charset=us-ascii /var/lib/mediawiki/extensions/BreadCrumbs2.php: text/plain; charset=us-ascii
 * 1) file -i /etc/mediawiki/LocalSettings.php  /var/lib/mediawiki/extensions/BreadCrumbs2.php

The real cause has to do with white spaces outside of the php start and end tags, see this link from Tech Recipes

Link crumbs to normalpages
add around line 40:

// Link crumbs to normal page, not to category page $tree[1] = preg_replace('/Category:/','',$tree[1]);

Remove Current Page Name from Breadcrumb?
Hi there. I'm loving this extension. Thank you very much! Is there any way to remove the current page name from the outputted breadcrumb? The reason I ask is because now that I have this extension every page that does not need/have a breadcrumb has the page name in place of it making it look something like this:

Main Page
Main Page Thank you! Schot 22:53, 16 November 2007 (UTC)

Response:
Try adding these lines to the MediaWiki:Breadcrumbs page and add your Main Page to a category called "Main Page":

* Main Page @ * default  @ Main Page >

It works for me! I too think this is a brilliant solution to getting breadcrumbs.

147.209.216.245 23:21, 24 January 2008 (UTC)

Number of Levels, something is wrong..
Hi, first of all: Great extension!! Please excuse so many questions, I am a dummy and I suppose the biggest is issue is that I do not get the (digital) logic behind this functions.

I am about to create an extremely structured Wiki, which implies also many levels. Eerythink is fine, but I do net get the following to work - the LeedsAccommodation line does not work at all.. * Going-to @ GoErasmus > Living Abroad > Going-to > * Living Abroad @ GoErasmus > Living Abroad > * LeedsAccommodation @ GoErasmus > UK > Leeds > Accommodation > * Leeds @ GoErasmus > United Kingdom > Leeds > * United Kingdom @ GoErasmus > United Kingdom > Page: [www.goerasmus.eu] Furthermore, I'd like to kill the UK in the LeedsAccommodation line, can I do this?? And how should I sort the lines in BreadCrumb then..

If it is a feature, it would be nice to describe on the extension page itself. My thesis is that many dummies are coming now and open a wiki… Thanks again for the great work! --Jorgusch 12:48, 12 June 2008 (UTC)
 * Btw, the solution for the Main Page does not work for me.
 * You mention above a way to link normal pages with breadcrumb–what I would like to do. How does it work then? Where does BreadCrumb know from, which line to choose? - See my 'logical question' above..

Does this (great) extension works with MW 1.13?
Its behaviour is strange, it doesn't recognize the my category "Home". 88.9.73.154 21:05, 1 August 2008 (UTC)

Breadcrumbs displaying only current page
I defined breadcrumbs for my page at Mediawiki:Breadcrumbs on my media wiki like this: * Finance @ Nlpedia > Finance >
 * Business @ Nlpedia > Finance > Business >

As a result I got breadcrumbs, but it only displays the lowest level for current page(the name of the article or category) but there's no link to the main page (or category when I'm in an article). Am I missing something here? Did I make some syntax error? Are there any additional things I should to make it work?

September 2009 -- Still getting this behavior in MW 1.13 -- anyone have this working?

January 2010 -- Doing same for me with MW 1.15.1 -- would love to see a fix to get this working, seems to be when using name > name2 > that it does not show all sub-pages if they are categories.

January 2013 -- Late reply, I had the same problem. The category actually has to exist. So go to Category:name, create the category, put in some text and then save it. You can remove the text later if you want. Hope this helps.

New Features
I made a few small modifications to the extension to allow:
 * Breadcrumbs to be placed by the template (Crumb result is passed to template via $template->data['breadcrumbs'] instead of subtitle; requires custom template to use and display). So you don't have to give up the subtitle to use the breadcrumbs extension. Access via $this->data['breadcrumbs'] in execute method of skin file.
 * MediaWiki:Breadcrumbs crumb specification to match page name (So, for example, "* Main Page @ Home" will provide a custom breadcrumb for the home page).
 * Require inclusion of the page name to be explicit in the crumb spec (using ), so it can be left out if you want to.

Modified lines (x3) are marked with **** function buildBreadcrumbs( $skin, $template ) { # Get the list of categories for the current page preg_match_all( '`title="Category:(.*?)"`', $skin->getCategories, $matches, PREG_PATTERN_ORDER ); $categories = $matches[1]; # Treat the namespace as a category too if ( $skin->mTitle->getNsText ) $categories[] = $skin->mTitle->getNsText; # ****: Treat the page name as a category too $categories[] = $skin->mTitle->getText; # Load and parse the breadcrumb template. If it's a redirected page, extract redirect info $crumbs = matchFirstCategory( CRUMBPAGE, $categories ); $breadcrumb = trim( $crumbs[0] ); # ****: Require page name to be explicitly set if ( preg_match('/\(Redirected.*?\)/', $template->data['subtitle'], $match) ) $breadcrumb .= ' '. $match[0]; # Set the page subtitle to the breadcrumb contents $template->set( 'breadcrumbs', $breadcrumb ); # ****: Store in breadcrumbs data object.

Debug Info?
I am having problems getting this extension to work with MW1.15. All indications seem to point to the extension working but I do not get the rewriting of the subtitle as I would expect it to. Is there any way to debug the extension to see if it is working correctly? I am afraid that it might not be able to call the hook to rewrite the subtitle, perhaps due to something in my setup.

I believe I am doing everything correctly:
 * Writing the breadcrumbs into MediaWiki:Breadcrumbs
 * Category tags on the pages that I want to apply the breadcrumbs to
 * All PHP scripts have permission 755
 * Special:Version shows that version 0.9 of the extension is installed

However the subtitle will not change on the pages no matter what.

Any suggestions?

''Edit: Okay, that was silly. I just noticed that if the category page is not saved, then it won't work. Silly mistake. Anyway, just leaving this up in case other people have similar trouble. Just save the category page with placeholder text.''

Doesnt seem to work in 1.16
Iam only getting the current pagename in the breadcrumb field. Tried a lots of configurations but no luck.

I went to see if the extension works properly in other wikis. This one has version 1.16.0 and Breadcrumbs2 seems to works quite well. This one has version 1.15.5 and it works well too. In contrast to that this one has version 1.11 and it seems to be broken. So it seems the bug has nothing to do with the mediawiki version.. Does anyone have a clue? Any help will be highly appreciated. Stefahn 2103, 6 January 2011 (UTC):
 * I have the same problem on my two wikis (versions 1.15.5 and 1.16.0).


 * I have also a problem using Version 1.16. I get Breadcrumbs displayed without the Breadcrumbs2-Extension. Perhaps because I have smwhalo installed. But the breadcrumbs work in a "How did I get here"-sence and not in the expected "Where am I"-sence. I added this line to MediaWiki:BreadCrumbs:


 * Best-Pratice@ Hauptseite > Best-Pratice >
 * When I deactivate SMWHalo I get only the page title displayed. I think that the Breadcrumbs-Feature of smwhalo and the Breadcrumbs2-Extension hinder each other. stevewilson, 19 December 2011 (UTC):


 * Meanwhile I could solve the problem. I didn't notice that you have to adapt the code if you're using another language than English. See here. I adapted the code and now it works like a charm (see here for example). Stefahn 19:57, 23 January 2012 (UTC)

Autogenerate Mediawiki:Breadcrumbs Category List
Has anyone got a successful implementation of using the code from the Mediawiki Breadcrumbs extension to automatically generate the list of categories?

I've got a simple, structured category hierarchy and it's a bit of a pain to have to re-enter the information manually, when the category tree could be automatically worked out.

Problem with 1.18
Just tried to run my wiki with 1.18, fails on: Call to a member function getNsText on a non-object line 51. More details as I figure them out.--Olivier Beaton 20:02, 29 November 2011 (UTC)

Fix problem with 1.18
Simply replace code "->mTitle->" by "->getTitle->". --Nda 19:22, 08 Januar 2012 (Moscow time)

code injection problem
Is due to the preg_replace use of the "/e" extension.

Any thoughts on how to correct this?

Code injection fixed
I have fixed the code injection and a few other errors when running this extension against the latest version of MediaWiki (currently under pending changes). I used preg_replace_callback instead of preg_replace with /e modifier to bypass any code injection. I also changed $skin->mTitle to $skin->getTitle and checked the state of $wgParser->mOutput before calls to $wgParser->disableCache.


 * Hello, could you please post the exact changes you made? I would love to use this extension and make it more safe. Thanks in advance! --77.2.156.93 17:17, 11 June 2012 (UTC)

Extension no longer works with mediawiki 1.23
I am using Mediawiki 1.23alpha (9e03598), and the extension does not work. Instead of breadcrumbs, it only displays the title of the page (non-linked).

Conversely, the classic BreadCrumbs extension still works just fine.

Please update the extension to work with the newest version of mediawiki. — Preceding unsigned comment added by 27.124.100.29 (talk • contribs) 01:09, 19 January 2014
 * I confirmed that it is working with 1.23. Please make sure that you followed the usage instructions. --Ike @ WikiWorks 22:37, 23 June 2014 (UTC)
 * I'm having the exact same problem in 1.23. I'm following the usage instructions perfectly. Any assistance would be great. — Preceding unsigned comment added by 98.225.11.166‎ (talk • contribs) 16:55, 23 August 2014‎
 * If you are having trouble with the extension, please post a live example. Please also see if the [ old version of the extension] works for you. --Ike @ WikiWorks 00:32, 25 August 2014 (UTC)