Extension:RemoveSubpagestr

What can this extension do?
Remove links from certain subpages back to their root page

Usage
If you create your own navigation at the top of a page and its subpages you may not want the automatically generated links to the root page to appear on the subpages. This extension allows you to define in your LocalSettings.php file a list of pages whose subpages should not link back to them.

Installation

 * Copy removeSubpagestr.php to your extensions folder

Parameters
$wgNoSubpagestr - an array of page titles whose subpage should not link back

Changes to LocalSettings.php

 * Add an array of page titles as described above
 * include the extension at the bottom of the page

$wgNoSubpagestr = array(	'My User Page', 	'Another parent page', ) ;

require_once("$IP/extensions/removeSubpagestr.php");

Code
<?php /** * Remove links from certain subpages back to their root page * * Installation: Copy removeSubpagestr.php to your extension folder and add * require_once($IP."/extensions/removeSubpagestr.php"); * to your LocalSettings.php * * @author Matthew Vickery * @version 1.0 */

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'removeSubpagestr';

function removeSubpagestr( $skin, $template ) { // The OutputPage Object used below to get the subtitle global $wgOut ; // Global array of root pages whose subpages should not have links back to the root page // Defined in LocalSettings.php global $wgNoSubpagestr ; // Grab the root page title from the current page title $pages = explode('/', $skin->mTitle->getText) ; $rootPage = $pages[0] ; // check if the root page's subpages should have Subpagestr links back to it		if (in_array($rootPage, $wgNoSubpagestr)) { $template->set(				'subtitle', 				$wgOut->getSubtitle			); }

return true; }

$wgExtensionCredits['other'][] = array(       'name' => 'removeSubpagestr',        'version' => '0.1',        'author' => 'Matthew Vickery',        'url' => 'http://www.mediawiki.org/wiki/Extension:RemoveSubpagestr',        'description' => 'Remove links from certain subpages back to their root page' );

?>

Other extensions by Mattvick

 * Extension:CustomUserCreateForm - Replace the standard user create form with a custom form