Extension talk:BreadCrumbs (Kimon)
Add topicNo output
[edit]If i install your extention, there is no output from the wiki anymore. if i download any wikipage with wget, index.html is just empty. any ideas? I run mediawiki 1.11.2 --87.165.92.192 09:05, 1 April 2009 (UTC)
I wasn't able to get any breadcrumbs in MediaWiki 1.11. nothing happens at all. I created the php and css-file and included it in LocalSettings.php. Is there something that I'm missing? 213.47.3.128 23:21, 23 November 2007 (UTC)
- Did you enable the breadcrumbs in your user preferences? --Kimon 15:03, 24 November 2007 (UTC)
Position Breadcrumbs on the Page (Insertion Point, part 2)
[edit]So I could see it better, I used this css to move it to the top and position it in the subtag area (the space under the Article Title). That's the reason for the -5.em. I also increased the count. Now when multiple lines wrap, everything pushes down correctly. This is a terrific extension!
#BreadCrumbsTrail { position: relative; top: -.5em; width:100%; border: none; padding-bottom: 4px; }
Differences with Extension:BreadCrumbs
[edit]Is there any difference between this and the other Breadcrumbs extension? By any chance do you have any plans of storing the statistics in a database for further scrutiny? SellFone 13:42, 3 December 2007 (UTC)
- There are a few differences:
- There are 2 files to maintain
- The breadcrumbs show up at the bottom (though this can be done via the CSS of the other one)
- The display of breadcrumbs is a user enabled option thereby displaying it only to users that want it
- Duplicate entries are removed
- If the user returns to a previously visited page, the breadcrumbs get trimmed back to that.
- As for a database table to track this information... that's a good idea, I'll give it some thought.
- I hope I've answered your questions --Kimon 18:15, 3 December 2007 (UTC)
Nothing happens on Mediawiki 1.7.1. [SOLVED]
[edit]I followed your installation instructions. The Special:Version page confirms that the extension is installed. I looked in the "misc" tab in "user preferences" but cannot find any "t/f" flag there. Can you confirm that your extension is not supposed to work with Mediawiki 1.7.1? If so; any plans on making it work for 1.7.1 too? I would be very happy if you have. Debian Etch uses 1.7.1. Todu 01:31, 6 December 2007 (UTC)
- It looks like the hook UserToggles was introduced in 1.8.0. But, I believe I have a work-around. You can comment out/remove the snippet
#can we see the breadcrumbs?
if($wgUser->getOption('breadcrumb')==0) {
return;
}
- It should work but, since I don't have a 1.7.1 installation to test, I cannot confirm. The drawback is that it will force it on all users.
- Let me know please so that I can make an entry in the extension's description. --Kimon 03:03, 6 December 2007 (UTC)
- It worked when I commented out your suggested snippet. However when I visit a page that I have already visited, that page does not contain the breadcrumbs. I have created 8 test pages that all link to each other. It didn't help revisiting the first test page after I've visited the eighth test page. I thought that might have emptied the breadcrubs cache somehow but it didn't. Todu 13:37, 6 December 2007 (UTC)
- Hmmm.... So, your path is Page1->Page2->Page3->Page4->Page5->Page6->Page7->Page8->Page1 ?
- Yes it is. Todu 14:48, 6 December 2007 (UTC)
- If that's correct, then do you see the breadcrumbs when you are visiting all the pages except when you visit Page1 for a second time?
- Or, when you get to Page1 again, it resets and you only see Page1? --Kimon 14:12, 6 December 2007 (UTC)
- I see them always as long as every page I visit is a first visit since I installed the extension. It never resets. Any time I visit a page I have already visited any time since the installation of the extension, any sign of the existence of the extension disappears. The breadcrumbs reappear as soon as I visit a page that I have not visited since the installation of the extension. Todu 14:48, 6 December 2007 (UTC)
- I guess I'll have to check it when I get home on your site. --Kimon 17:35, 6 December 2007 (UTC)
- I see them always as long as every page I visit is a first visit since I installed the extension. It never resets. Any time I visit a page I have already visited any time since the installation of the extension, any sign of the existence of the extension disappears. The breadcrumbs reappear as soon as I visit a page that I have not visited since the installation of the extension. Todu 14:48, 6 December 2007 (UTC)
- Hmmm.... So, your path is Page1->Page2->Page3->Page4->Page5->Page6->Page7->Page8->Page1 ?
- It worked when I commented out your suggested snippet. However when I visit a page that I have already visited, that page does not contain the breadcrumbs. I have created 8 test pages that all link to each other. It didn't help revisiting the first test page after I've visited the eighth test page. I thought that might have emptied the breadcrubs cache somehow but it didn't. Todu 13:37, 6 December 2007 (UTC)
- I've created a temporary GNU/Debian Etch (4.0) installation for you on one of my servers, if you want to experiment with a 1.7.1 installation. You can email me so I can give you your root password. And for all the crackers out there: Don't bother emailing me before Kimon does. I'll wipe the server as soon as Kimon is finished with his testing. I could replace the Linux installation with any of these distributions if you would prefer a non-Debian one (it only takes about 2 minutes to make a fresh one):
Newer distributions: Arch Linux 2007.08 Centos 5.0 Debian 4.0 Fedora Core 8 Gentoo 2007.0 OpenSUSE 10.3 Slackware 12.0 Ubuntu 7.10 Older Distributions: CentOS 4.0 (RHEL) Fedora Core 6 Gentoo 2006.1 Mandrake 9.1 Slackware 10 Ubuntu 6.06 Ubuntu 7.04
I'm not home so I cannot read my home email. But I logged in to our server to check progress (less .bash_history) and noticed we ran out of disk space. So I rebooted, increased from 512 to 1024 MB and finished your apt-get install mysql-server and did a apt-get dist-upgrade too. So now you should be able to proceed with the next steps. /Tommy
- Done - check it out --Kimon 21:36, 8 December 2007 (UTC)
- You're the man! It works perfectly on the test server now. I'm just on my way home from work now and will contact you again when I arrived. What did you change to make it work? /Tommy
- the issue was with caching. It appears that $wgTitle->invalidateCache(); and $wgUser->invalidateCache(); don't work on 1.7.1 so I modified the LocalSettings.php caching to:from
$configdate = gmdate( 'YmdHis');
$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
- The drawback is that caching is invalidated for all users. --Kimon 22:09, 8 December 2007 (UTC)
- I changed the line you mentioned above and can confirm that your extension now works on my real Mediawiki 1.7.1 installation aswell. Thank you! Todu 23:24, 8 December 2007 (UTC) (Tommy)
- You may also want to change the line
- I changed the line you mentioned above and can confirm that your extension now works on my real Mediawiki 1.7.1 installation aswell. Thank you! Todu 23:24, 8 December 2007 (UTC) (Tommy)
- the issue was with caching. It appears that $wgTitle->invalidateCache(); and $wgUser->invalidateCache(); don't work on 1.7.1 so I modified the LocalSettings.php caching to:
- You're the man! It works perfectly on the test server now. I'm just on my way home from work now and will contact you again when I arrived. What did you change to make it work? /Tommy
$m_trail = "<div id=\"BreadCrumbsTrail\"> <i>Bread crumbs:</i> ";
to
$m_trail = "<div id=\"BreadCrumbsTrail\" style=\"";
$m_trail .= 'font-size:0.8em;background-color: #FFFFCC;position:absolute;left: 2px;bottom:0;width:99%;';
$m_trail .= "\"> <i>Bread crumbs:</i> ";
--Kimon 23:46, 8 December 2007 (UTC) The above is because apparently $wgOut->addLink() is not available in 1.7.1 --Kimon 23:48, 8 December 2007 (UTC)
Found an (off by one?) bug
[edit]Try this path:
Bread crumbs: Test > Test2 > Test3 > Test4 > Test5
and then click on Test4 again. You will see that "Test" disappears. I think you have an off by one error somewhere.Todu 02:09, 9 December 2007 (UTC)
- Also, can I disable the shrinking of the breadcrumb list all together? And make the list appear on top of the pages instead of on the bottom? I would want the list to not change in any way in case I revisit a page that is currently on the list. Todu 02:09, 9 December 2007 (UTC)
- Try changing this:
# if we've got too many entries, reduce the array:
if( count( $m_BreadCrumbs ) > 0 && $m_BreadCrumbs[ $m_count ] != $wgTitle->getPrefixedText() ) {
# reduce the array set, remove older elements:
$m_BreadCrumbs = array_slice( $m_BreadCrumbs, ( 1 - $wgBreadCrumbsCount ) );
# add new page:
array_push( $m_BreadCrumbs, $wgTitle->getPrefixedText() );
}
else {
array_push( $m_BreadCrumbs, $wgTitle->getPrefixedText() );
}
#if returning to a page we've already visited, reduce the array
$loc = array_search($wgTitle->getPrefixedText(), $m_BreadCrumbs);
if(($loc >= 0)) {
#shrink array
$m_BreadCrumbs = array_slice($m_BreadCrumbs, 0, ($loc + 1));
}
to
array_push( $m_BreadCrumbs, $wgTitle->getPrefixedText() );
- Then to change the position, just change
$m_trail .= 'font-size:0.8em;background-color: #FFFFCC;position:absolute;left: 2px;bottom:0;width:99%;';
to
$m_trail .= 'font-size:0.8em;background-color: #FFFFCC;position:absolute;left: 2px;width:99%;';
- I found this to be placing the text correctly:
$m_trail .= 'font-size:0.8em;background-color: #FFFFCC;position:absolute;left: 2px;top:34px;width:99%;';
- Your suggestion to remove "bottom:0" caused it to write the breadcrumb list onto the page title. Maybe it is different in different browsers? I use Firefox, you?
- And regarding the shrinking list; Now it does not shrink, which is good. But it keeps growing beyond five entries. Todu 03:00, 9 December 2007 (UTC)
- You can try using the "top:XX" (replace XX with whatever number you want). Try messing with it until you place it in the right spot.
- As for going beyond 5 entries, I thought that's what you wanted. You can restore the code you removed above but leave this part commented out:
#if returning to a page we've already visited, reduce the array
$loc = array_search($wgTitle->getPrefixedText(), $m_BreadCrumbs);
if(($loc >= 0)) {
#shrink array
$m_BreadCrumbs = array_slice($m_BreadCrumbs, 0, ($loc + 1));
}
- If you want to increase beyond 5 entries, increase the value of the parameter $wgBreadCrumbsCount. --Kimon 11:03, 9 December 2007 (UTC)
- Now everything seems to work perfect except for when I hit F5 to refresh the current page. In that case the breadcrumb trail grows beyond five entries. Todu 14:27, 9 December 2007 (UTC)
- Do you (or anyone) have a fix for the "refresh bug"? Todu 18:48, 12 December 2007 (UTC)
- Now everything seems to work perfect except for when I hit F5 to refresh the current page. In that case the breadcrumb trail grows beyond five entries. Todu 14:27, 9 December 2007 (UTC)
- If you want to increase beyond 5 entries, increase the value of the parameter $wgBreadCrumbsCount. --Kimon 11:03, 9 December 2007 (UTC)
BreadCrumbs insertion point
[edit]What would need to be modified in order to get the breadcrumbs to show up in the page subtitle field? This is something being done in the "BreadCrumbs2" extension, but the breadcrumbs themselves aren't constructed the same way as this extension does (which I prefer). The hope is to find a way of getting Kimon's breadcrumbs placed in the subtitle area (so they don't cover anything else, and give a nice tight positioning against the page name at the top of the page). Pfurrie 23:36, 20 December 2007 (UTC)
- I'm sure that can happen by messing around with the CSS. Though I'm not an expert on it, I'll give it a try. --Kimon 13:32, 10 January 2008 (UTC)
- I had this same problem but I was able to set it up so it is at the top, all you need to do is change 1 line of code in the css.
position:top; left: 2px; bottom:0; width:99%;
this seemed to work just fine for me.
Enabling by default
[edit]moved from my talk page
Hi Kimon! Your breadcrumb extension is great. Is there a way to make it a default user preference so that all visitors automatically see it? --unsigned by 72.130.221.70 on 2008-01-10 03:16
- You can set
$wgDefaultUserOptions['breadcrumb'] = 1;
- in your LocalSettings.php file. --Kimon 13:41, 10 January 2008 (UTC)
- Doesn't work. No such variable in php file --94.210.70.111 21:35, 2 June 2009 (UTC)
Disable on Main Page
[edit]How would I disable this for the main page?
Extensions/BreadCrumbs/BreadCrumbs.css shows up in the breadcrums
[edit]I've installed your extension on a few MediaWiki's now to test it and I get this error:
When I click a few pages it gives the url of BreadCrums.css as a breadcrum like this:
- I go from main page to the client portal is gives:
- Bread crumbs: Main Page > Extensions/BreadCrumbs/BreadCrumbs.css > Portal:Clients
- Then i click current events and the breadcrums show up like this:
- Bread crumbs: Main Page > Extensions/BreadCrumbs/BreadCrumbs.css > Current events
So does not add a breadcrumb it replaces the one that is already there as if I am comming from the main page. Any idea how i can fix this?
Thx B--41.240.74.249 10:10, 14 January 2008 (UTC)
Solved
[edit]I also had the same problem and modified the BreadCrumbFunctions.php file. I added a line, below line 25, that simply checks the page title and if it contains BreadCrumbs.css, to return from the function. Below, I've listed line 25 which was already there, and line 26 is the line I added.
25: if( isset( $_SESSION['BreadCrumbs'] ) ) $m_BreadCrumbs = $_SESSION['BreadCrumbs']; 26: if (preg_match('/Extensions\/BreadCrumbs\/BreadCrumbs.css/', $wgTitle->getPrefixedText())) return true;
--mike DOT rosile AT gmail DOT com
How to integrate BreadCrumbs
[edit]I am a mediaWiki greenhorn and I have a more basic question about the breadcrumb extension: How do I get BreadCrumbs to show up? I installed the extension as described... and what then? How do I include Breadcrumbs into my pages? Should they just show up automatically or do I have to add some html/php code to every page....
May be you could give a sample code. Thx!!
- - Look at the very top of this page, or read the section titled "Enabling by default"
How to remove the Bread crombs name
[edit]for all others that might be interested, i just removed the 'Bread crumbs' name that is visible at default. Just delete "Bread crumbs" text in the trail line in BreadCrumbs.php
See a working example at my website klusopedia.nl
Disabling Breadcrumbs per user
[edit]Hi, Is there a way to disable breadcrumb feature based on logged in user's preferences (or generally by default)? I do not have breadcrumb in Default User Options but it's still showing to all users. Now, I want it to be user based. Please help. Thanks a lot.
Hide bread crumbs in print view
[edit]With the styles suggested on the extension page, the bread crumbs show up in the print view which doesn't make much sense. I modified the CSS like this to to hide them there:
@media screen {
#BreadCrumbsTrail {
font-size: 0.8em;
background-color: #FFFFCC;
position: absolute;
left: 2px;
bottom: 0;
width: 99%;
}
}
@media print {
#BreadCrumbsTrail {
display: none;
}
}
Error
[edit]Once I enable in my preferences i get the error
Warning: Parameter 2 to BreadCrumbs::output() expected to be a reference, value given in C:\xampp\htdocs\wiki\includes\Hooks.php on line 117 Internal error
MediaWiki 1.15.1 Windows XP latest XAMPP installation
--Red3001 21:34, 27 January 2010 (UTC)
Incompatible with v1.16?
[edit]Special:Preferences was changed in v1.16 and this extension does not seem to work with it. A shame, because we seem to lack any other decent "where have I been" breadcrumbs extensions. Tisane 08:40, 29 March 2010 (UTC)
- Oh, I just noticed the workaround above. That works. Tisane 12:00, 29 March 2010 (UTC)
I believe this extension might be made to work with v1.16 by using the development code from Extension:OnlineStatus as an example. I may get to that a bit later, and if so, I'll use Template:Inuse. Tisane 09:22, 3 April 2010 (UTC)
BreadCrumbs not returnning to 0 sometimes but keep bulding up
[edit]Sometimes (can't find root cause) breadcrumbs do not zero when going back to main page but rather continue on bulding up Eg: Main Page> something > something > Main Page > something....
- adjunct - April 06, 2010
Is it just me, or am I seeing double?
[edit]Instead of just getting ">" between the pages in the trail, I get "> - >", with the "-" pointing to - nowhere.
running version MediaWiki 1.15
--Zaniwoop 10:21, 14 April 2010 (UTC)
Not working with 1.16b3 + Vector skin?
[edit]I tried this, with the 1.16 workaround, and I got an error.
Detected bug in an extension! Hook BreadCrumbs::output failed to return a value; should return true to continue hook processing or false to abort. Backtrace: #0 /Applications/MAMP/htdocs/mw/includes/OutputPage.php(1112): wfRunHooks('OutputPageParse...', Array) #1 /Applications/MAMP/htdocs/mw/includes/OutputPage.php(1121): OutputPage->addParserOutputNoText(Object(ParserOutput)) #2 /Applications/MAMP/htdocs/mw/includes/Article.php(4003): OutputPage->addParserOutput(Object(ParserOutput)) #3 /Applications/MAMP/htdocs/mw/includes/Article.php(1345): Article->outputWikiText(''''This page is...', true, Object(ParserOptions)) #4 [internal function]: Article->doViewParse() #5 /Applications/MAMP/htdocs/mw/includes/PoolCounter.php(59): call_user_func(Array) #6 /Applications/MAMP/htdocs/mw/includes/Article.php(900): PoolCounter_Stub->executeProtected(Array, Array) #7 /Applications/MAMP/htdocs/mw/includes/Wiki.php(493): Article->view() #8 /Applications/MAMP/htdocs/mw/includes/Wiki.php(70): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest)) #9 /Applications/MAMP/htdocs/mw/index.php(117): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest)) #10 {main}
The src in question does appear to have an acceptable return statement, but I don't know enough PHP to diagnose this. Can someone help? --FilSalustri 08:51, 15 June 2010 (UTC)
Version 1.21 not working with Vector Skin
[edit]I see the last post in 2010 was not answered but figured it is still worth a try because this is the only type of extension that I am able to find that fits to what I need - To not have duplicates of visited pages. It is getting hung up on Line 108 in BreadCrumbs.php (after removing #can you see breadcrumbs) on $m_skin =& $wgUser->getSkin();
This is the error I am getting - Can anyone help, please?
[4980dec6] /mediawiki/index.php/Hardware Exception from line 1619 of C:\wamp\www\mediawiki\includes\Skin.php: Call to undefined method SkinVector::makeLink
Backtrace:
- 0 C:\wamp\www\mediawiki\extensions\Breadcrumbs\BreadCrumbs.php(112): Skin->__call(string, array)
- 1 C:\wamp\www\mediawiki\extensions\Breadcrumbs\BreadCrumbs.php(112): SkinVector->makeLink(string)
- 2 [internal function]: BreadCrumbs->show(Article, boolean, boolean)
- 3 C:\wamp\www\mediawiki\includes\Hooks.php(199): call_user_func_array(array, array)
- 4 C:\wamp\www\mediawiki\includes\GlobalFunctions.php(3877): Hooks::run(string, array)
- 5 C:\wamp\www\mediawiki\includes\Article.php(615): wfRunHooks(string, array)
- 6 C:\wamp\www\mediawiki\includes\actions\ViewAction.php(44): Article->view()
- 7 C:\wamp\www\mediawiki\includes\Wiki.php(448): ViewAction->show()
- 8 C:\wamp\www\mediawiki\includes\Wiki.php(312): MediaWiki->performAction(Article, Title)
- 9 C:\wamp\www\mediawiki\includes\Wiki.php(602): MediaWiki->performRequest()
- 10 C:\wamp\www\mediawiki\includes\Wiki.php(467): MediaWiki->main()
- 11 C:\wamp\www\mediawiki\index.php(49): MediaWiki->run()
- 12 {main}
Thank you!