Extension:Navigation path
From MediaWiki.org
|
Navigation Path Release status: beta |
|
|---|---|
| Description | Used as a memory list. |
| Author(s) | KOSELLEK FranckTalk |
| Last version | 0.1 |
| License | No license specified |
| Download | No link |
|
Check usage (experimental) |
|
Contents |
[edit] What can this extension do?
This extension add a navigation bar into your page.
It take the url and parse using ":" char.
[edit] Usage
<npath border=border_color background=background_color name=name />
Parameters :
-
- border : OPTIONAL, to precise the border-color, Default is black.
- background : OPTIONAL. to precise the background color. Default is white;
- name : OPTIONAL . To precise the name before the Nav Bar. Default is "Path : "
[edit] Download instructions
Please cut and paste the code found below and place it in $IP/extensions/npath/navigation_path.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
#add configuration parameters here #setup user rights here require_once("$IP/extensions/npath/navigation_path.php");
[edit] Configuration parameters
[edit] User rights
[edit] Code
<?php /****************** http://aiantis.net Author : Fricky Version : 0.1 Beta DESCRIPTION ------------- Navigation Path is a Navigation bar respecting the tree structure of your location, It use the url and parse automatically with ":" char. USAGE ------ <npath border=border_color background=background_color name=name /> Parameters : ** border : OPTIONAL, to precise the border-color, Default is black. ** background : OPTIONAL. to precise the background color. Default is white; ** name : OPTIONAL . To precise the name before the Nav Bar. Default is "Path : " EXAMPLE -------- <npath border=red background=green /> *********************************************************/ $wgExtensionFunctions[] = "npath"; function npath() { global $wgParser; $wgParser->setHook( "npath", "build_ts" ); $wgParser->disableCache(); } function build_ts ( $input, $argv=array() ) { if ($argv["border"]) $border = $argv["border"]; else $border= 'black'; if ($argv["background"]) $background = $argv["background"]; else $background = "white"; if ($argv["name"]) $name = $argv["name"]; else $name = "Path : "; $url = '<div id="path" style="border:1px solid ' . $border . '; background:' . $background . '; padding:4px;">-</div> <script> var url = document.location.href; var begining = ""; var temp = ""; var str = ""; if (url.indexOf("title=")!= -1) { temp = url.split("title="); begining = temp[0] + "title="; str = temp[1]; } else { temp = url.split(".php/"); begining = temp[0] + ".php/"; str = temp[1]; } temp = str.split(":"); var count = 0; var path = begining; str = ""; while (temp[count]) { path += temp[count]; if (temp[count + 1]) { str += "<a href=\'" + path + "\'>" + temp[count] + "</a>"; path += ":"; str += " <b>></b> "; } else if (temp[count].indexOf("action=")== -1) str += "<b>" + temp[count] + "</b>"; else { meuh = escape(temp[count]); plop = meuh.split("%26action%3D"); str += "<b>" + plop[0] + " </b><i>(action)</i>"; } count++; } str = decodeURI(str); document.getElementById("path").innerHTML = "<b>' . $name . '</b> " + str; </script> '; return $url; } ?>