Extension talk:BreadCrumbs/LQT Archive 1

Another one: http://wiki.ljackson.us/MediaWiki_BreadCrumbs --pfctdayelise 05:03, 16 April 2007 (UTC)

I am getting the following Notice until I login. Once I login, the notice goes away, even after I logout. I am new to php and am trying to troubleshoot this. If I find a solution, I will post it here. --Clarke Christiansen Notice: Undefined offset:  -1 in C:\Projects\csbswiki\wiki\extensions\BreadCrumbs\BreadCrumbsFunctions.php on line 30

The problem was 2 fold. --Clarke Christiansen Here is my updated code for BreadCrumbsFunctions.php that seems to fix the problems. I am new to php here, so be nice.  0. On the first page load this would be true.    The result is the Notice above where we are trying to loop through an array that is empty and worse yet we are starting at -1.
 * 2) If you have not done anything to trigger session_start, like logging in, BreadCrumbs will not accumulate. To fix this I am checking  for $_SESSION and starting the session if it is not there.


 * 1) The BreadCrumbs extension, an extension for providing an breadcrumbs
 * 2) navigation to users.


 * 1) @addtogroup Extensions
 * 2) @author Manuel Schneider 
 * 3) @copyright © 2007 by Manuel Schneider
 * 4) @licence GNU General Public Licence 2.0 or later

if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); die; }

function fnBreadCrumbsShowHook( &$m_pageObj ) { global $wgTitle; global $wgOut; global $wgUser; global $wgBreadCrumbsDelimiter; global $wgBreadCrumbsCount; # deserialize data from session into array: $m_BreadCrumbs = array; if( isset( $_SESSION['BreadCrumbs'] ) ) { $m_BreadCrumbs = $_SESSION['BreadCrumbs']; } else { if( !isset( $_SESSION ) ) { session_start; }   $_SESSION['BreadCrumbs'] = array; } # cache index of last element: $m_count = count( $m_BreadCrumbs ) - 1; # check for doubles: 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 ); }

# serialize data from array to session: $_SESSION['BreadCrumbs'] = $m_BreadCrumbs; # update cache: $m_count = count( $m_BreadCrumbs ) - 1; # acquire a skin object: $m_skin =& $wgUser->getSkin; # build the breadcrumbs trail: $m_trail = ' '; for( $i = 0; $i <= $m_count; $i++ ) { $m_trail .= $m_skin->makeLink( $m_BreadCrumbs[$i] ); if( $i < $m_count ) $m_trail .= $wgBreadCrumbsDelimiter; } $m_trail .= ' '; $wgOut->addHTML( $m_trail ); # invalidate internal MediaWiki cache: $wgTitle->invalidateCache; $wgUser->invalidateCache; # Return true to let the rest work: return true; }

function fnBreadCrumbsOutputHook( &$m_pageObj, &$m_parserOutput ) { global $wgScriptPath;
 * 1) Entry point for the hook for printing the CSS:

# Register CSS file for our select box: $m_pageObj->addLink(   array( 'rel'  => 'stylesheet', 'type' => 'text/css', 'href' => $wgScriptPath. '/extensions/BreadCrumbs/BreadCrumbs.css' ) );

# Be nice: return true; } ?>

Looks worth linking to... Thanks for your work. ljackson.us --75.144.5.60 16:49, 9 May 2007 (UTC)

Well, somehow my breadcrumbs don't appear! When checking Apache's error log nothing can be found there out of the ordinary.

How do I change the location of the BreadCrumbs??
I would like to change the location of the BreadCrumbs. I would like to place the BreadCrumbs before the page title or on the same line as the tabs and under the my talk, my preferences, my watchlist area. Can someone tell me if this is possible?

Thanks. --Mlbowden 14:37, 27 June 2007 (UTC)