Open main menu

Extension talk:BreadCrumbs

About this board

previous talk on this page


216.165.95.72 (talkcontribs)

Hi there,

I'm noticing that certain config options are working correctly, but others are not. In my LocalSettings.php, I have changed configs like the following:

$wgDefaultUserOptions['breadcrumbs-delimiter'] = '––>'; $wgBreadCrumbsShowAnons = false;

$wgBreadCrumbsIgnoreNameSpaces = array("Special:AllPages"); $wgDefaultUserOptions['breadcrumbs-numberofcrumbs'] = 2;

The first two have taken effect and work. The second two do not work.

Is this the correct way of adding these configs to my LocalSettings?

Any help would be much appreciated.

216.165.95.72 (talkcontribs)

Sorry, some formatting issues. Question should read as below:

Hi there,

I'm noticing that certain config options are working correctly, but others are not. In my LocalSettings.php, I have changed configs like the following:

$wgDefaultUserOptions['breadcrumbs-delimiter'] = '––>';

$wgBreadCrumbsShowAnons = false;

$wgBreadCrumbsIgnoreNameSpaces = array("Special:AllPages");

$wgDefaultUserOptions['breadcrumbs-numberofcrumbs'] = 2;

The first two have taken effect and work. The second two do not work.

Is this the correct way of adding these configs to my LocalSettings?

Any help would be much appreciated.

Calebfergie (talkcontribs)

Hi there, how did you arrive at the decision to try $wgBreadCrumbsIgnoreNameSpaces = array("Special:AllPages")?


I too would like to ignore Special pages, but cant seem to figure out how.

Reply to "Config options not working?"

Updated to MW 1.25+ to use wfLoadExtension

1
194.98.70.138 (talkcontribs)

I have updated my local copy of the extension code to use the newer extension loading mechanism in MW 1.25+. This has involved creating an extension.json file and changing the hooks file to be a class. This code is probably useful to others, but I do not have or want repository access so it is reproduced below. Sorry for the long message.

Ben

BreadCrumbsFunctions.php

Obsolete. Can be deleted.

BreadCrumbs.php

Obsolete. Can be deleted.

new LocalSettings.php contents:

wfLoadExtension( 'BreadCrumbs' );

$wgBreadCrumbsDelimiter = ' > ';

$wgBreadCrumbsCount = 5;

$wgBreadCrumbsShowAnons = true;

new file - extension.json

{

"name": "BreadCrumbs",

"author": "Manuel Schneider",

"url": "http://www.mediawiki.org/wiki/Extension:BreadCrumbs",

"descriptionmsg": "breadcrumbs-desc",

"type": "parserhook",

"ExtensionMessagesFiles": {

"Breadcrumbs": "BreadCrumbs.i18n.php"

},

"ResourceModules": {

"ext.breadCrumbs": {

"styles": "BreadCrumbs.css"

}

},

"ResourceFileModulePaths": {

"localBasePath": "",

"remoteExtPath": "BreadCrumbs"

},

"Hooks": {

"ArticleViewHeader": [

"BreadCrumbsHooks::fnBreadCrumbsShowHook"

],

"OutputPageParserOutput": [

"BreadCrumbsHooks::fnBreadCrumbsOutputHook"

]

},

"AutoloadClasses": {

"BreadCrumbsHooks": "BreadCrumbs.hooks.php"

}

}

new file - BreadCrumbs.hooks.php

class BreadCrumbsHooks {

public static function fnBreadCrumbsShowHook( &$article ) {

global $wgOut, $wgUser;

global $wgBreadCrumbsDelimiter, $wgBreadCrumbsCount, $wgBreadCrumbsShowAnons;

if ( !$wgBreadCrumbsShowAnons && $wgUser->isAnon() )

return true;

// deserialize data from session into array:

$m_BreadCrumbs = array();

if ( isset( $_SESSION['BreadCrumbs'] ) ) $m_BreadCrumbs = $_SESSION['BreadCrumbs'];

// cache index of last element:

$m_count = count( $m_BreadCrumbs ) - 1;

// Title object for the page we're viewing

$title = $article->getTitle();

// check for doubles:

if ( $m_count < 1 || $m_BreadCrumbs[ $m_count ] != $title->getPrefixedText() ) {

if ( $m_count >= 1 ) {

# reduce the array set, remove older elements:

$m_BreadCrumbs = array_slice( $m_BreadCrumbs, ( 1 - $wgBreadCrumbsCount ) );

}

// add new page:

array_push( $m_BreadCrumbs, $title->getPrefixedText() );

}

// serialize data from array to session:

$_SESSION['BreadCrumbs'] = $m_BreadCrumbs;

// update cache:

$m_count = count( $m_BreadCrumbs ) - 1;

// build the breadcrumbs trail:

$m_trail = '<div id="BreadCrumbsTrail">';

for ( $i = 0; $i <= $m_count; $i++ ) {

$title = Title::newFromText( $m_BreadCrumbs[$i] );

$m_trail .= Linker::link( $title, $m_BreadCrumbs[$i] );

if ( $i < $m_count ) $m_trail .= $wgBreadCrumbsDelimiter;

}

$m_trail .= '</div>';

$wgOut->addHTML( $m_trail );

// invalidate internal MediaWiki cache:

$title->invalidateCache();

$wgUser->invalidateCache();

// Return true to let the rest work:

return true;

}

// Entry point for the hook for printing the CSS:

public static function fnBreadCrumbsOutputHook( &$outputPage, $parserOutput ) {

global $wgBreadCrumbsShowAnons;

if ( $wgBreadCrumbsShowAnons || $outputPage->getUser()->isLoggedIn() ) {

$outputPage->addModules( 'ext.breadCrumbs' );

}

// Be nice:

return true;

}

}

Reply to "Updated to MW 1.25+ to use wfLoadExtension"

Breadcrumb shows not the navigation - it shows the history

2
212.185.178.161 (talkcontribs)

perhaps I understand it wrong:

I expected this behavior:
MainPage --> Page 1 (linked on MainPage) --> Page 2 (linked on Page 1)
When I now click on the Page 1 Breadcrumb Link I expected that it looked in that way:
MainPage --> Page 1 (linked on MainPage)

But it looks like: MainPage --> Page 1 (linked on MainPage) --> Page 2 (linked on Page 1) --> Page 1



It would be very interesting how to change this with the options. Best regards and thanks

65.97.149.194 (talkcontribs)

yes, if you click a link in the breadcrumb trail, it should deprecate the trail to the point where you clicked, not add the new link to the end of the trail creating a looping reference of links.

Reply to "Breadcrumb shows not the navigation - it shows the history"
Rob Kam (talkcontribs)

How to disable breadcrumbs from appearing on the printed wiki pages please?

Rob Kam (talkcontribs)

To hide the breadcrumbs from the page's print version add to MediaWiki:Print.css:

div#breadcrumbs {
display: none;
}
Reply to "Breadcrumbs on printouts"

Additional references to non-existent pages in breadcrumbs

1
Pdr3112 (talkcontribs)

Post login, there is reference to non-existent pages which are actually images. Amy idea as to why this is coming in?

The images are loaded correctly from the images folder. Do not know why MW is treating the load as a page? Also, tried uploading the file itself on MW via Upload API but still issue persists.

Breadcrumbs
Reply to "Additional references to non-existent pages in breadcrumbs"
198.29.191.149 (talkcontribs)

For some reason BreadCrumbs omits certain page titles. It seems that when I go to a page that I was recently on, but have visited enough pages since to push it off of the Breadcrumbs list, when I go back it will not show the page. I do not know if this is a problem with the caching of the BreadCrumbs or what. Could it have to do with how often the cache is invalidated and the length of the BreadCrumbs shown not being the same? If the page is far enough back, it will show up in the BreadCrumbs however.

Reply to "BreadCrumbs omitting pages"
Cdaringe (talkcontribs)

Hi all: Would it make sense to have an option where if the user clicks a previously visited page in the trail, the trail "rolls back" to that spot? Perhaps it's already there, I just haven't explored it yet! -CD

AABoyles (talkcontribs)

Hey CD,

I had never thought of that. I'm in the process of rewriting the whole project, and I'll take a look to see how much effort it would take to do that. Great idea! Thanks a lot.

Cdaringe (talkcontribs)

Hey AAboyles: Way cool. Well, if you do ever get around to it, I'll test the heck outta it for ya :) Thx, CD

107.0.33.130 (talkcontribs)

Hi there - Did this ever happen? I would love for this option to be applied.

Reply to "BreadCrumbs Roll-back"

[SOLVED] Make Bread Crumb UPO appear in Special:Preferences#mw-prefsection-rendering

3
Summary by Wikinaut
79.98.163.245 (talkcontribs)

I have recently installed this extension and I found that it was necessary to make a single character change, to add an ampersand, in order for the preferences to be shown.

I downloaded the "Git master" snapshot on 2013-03-22 and it was necessary to change, in BreadCrumbs.php:

function fnBreadCrumbsAddPreferences( $user, $defaultPreferences ) {

to:

function fnBreadCrumbsAddPreferences( $user, &$defaultPreferences ) {

I don't know enough about the GetPreferences hook to know if the requirement to add the & is a peculiarity of my installation, or the way that things should be. --79.98.163.245 10:55, 25 March 2013 (UTC)

AABoyles (talkcontribs)

No, that's definitely a bug. I'll be sure it gets fixed in the upcoming, super-charged, latest-and-greatest BreadCrumbs, powered by Javascript. Thanks for the tip!

Reply to "[SOLVED] Make Bread Crumb UPO appear in Special:Preferences#mw-prefsection-rendering"

Bread crumbs overlap the page title's underline

1
94.188.248.67 (talkcontribs)

The bread crumbs appear in the right order, the only problem is that they do not appear in the right place. The bread crumbs overlap the underline of the page title.

How can it be fixed?


IE version: 8

MediaWiki 1.21.1

PHP 5.4.19 (apache2handler)

MySQL 5.5.32

Skin: Vector

Reply to "Bread crumbs overlap the page title's underline"
Frabo (talkcontribs)

There seems to be some interference with the __NOTITLE__ Magic Word: If Breadcrumbs is activated, the page title is shown on each page, no matter if there is __NOTITLE__ on the page. If the page is purged, it disappears again, as it should. In case the page is reloaded by the browser, the title appears again. But this is probably a minor issue for a great extension!

Reply to "Interference with __NOTITLE__"
Return to "BreadCrumbs" page.