User:Brett.Dutton: Difference between revisions
Appearance
Content deleted Content added
Brett.Dutton (talk | contribs) This is documentation for the BrettCrumbs.php plugin |
Brett.Dutton (talk | contribs) |
||
| Line 5: | Line 5: | ||
BrettCrumbs provides a simple way of displaying the breadcrumns based on using the "/" character as hierarchy. |
BrettCrumbs provides a simple way of displaying the breadcrumns based on using the "/" character as hierarchy. |
||
So a page <nowiki>http://192.168.1.100/wiki/index.php/Process_Documentation/Software_Engineering_Guidelines</nowiki> would be displayed with bread |
So a page <nowiki>http://192.168.1.100/wiki/index.php/Process_Documentation/Software_Engineering_Guidelines</nowiki> would be displayed with bread crumbs at the top: |
||
Home < Process Documentation |
Home < Process Documentation |
||
Revision as of 03:38, 2 July 2008
Brett Dutton Page
Documentation of BrettCrumbs.php
Created BrettCrumbs so that I could have a simple breadcrumbs navigation within wiki.
BrettCrumbs provides a simple way of displaying the breadcrumns based on using the "/" character as hierarchy.
So a page http://192.168.1.100/wiki/index.php/Process_Documentation/Software_Engineering_Guidelines would be displayed with bread crumbs at the top:
Home < Process Documentation
Changes to LocalSettings.php
# Added this to get Breadcrumbs navigation require_once( "$IP/extensions/BrettCrumbs.php" );
Source Code for BrettCrumbs.php
<?php
# Author: Brett Dutton
# breattcraigdutton at hotmail dot com
$wgHooks['ParserAfterTidy'][] = 'BrettCrumbs';
function BrettCrumbs ( &$parser, &$text) {
global $wgTitle, $wgScript, $action ;
if ( $action == 'edit' ) return true;
if ( $action == 'history' ) return true;
if ( $wgTitle->getPrefixedText() == 'Main Page' ) return true;
$arr = split ( "/", $wgTitle->getPrefixedText() );
$arrLen = count ( $arr ) - 1;
$url = "<small><a href=\"{$wgScript}/Main_Page\">Home</a>";
$links = "";
for ( $i=0; $i<$arrLen; $i++ ) {
$links .= "/" . $arr[$i];
$url .= " < <a href=\"{$wgScript}{$links}\">" . $arr[$i] . "</a>";
}
$url .= "</small>";
$text = $url . $text;
return true;
}
?>