User:Jeremy Pyne/Nice Page Names in Category List

From MediaWiki.org

Jump to: navigation, search

This hack will show pages in a category by their name instead of the their parents name.

Find line 172 of includes/CategoryPage.php

function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;

Add after

	
/**
 * Hack to show pages in a category by their name instead of the their parents name.
 * Jeremy Pyne <jeremy.pyne@gmail.com>
 */ 
$categoryPrefix = array_pop(explode(':', $this->title->getText()));
$titlePrefix = array_shift(explode('/', $title->getText()));
		
if($categoryPrefix == $titlePrefix) {
	$label = str_replace($titlePrefix.'/', '', $title->getText());
	$sortkey = str_replace($titlePrefix.'/', '', $sortkey);
} else {
	$label = $title->getText();
}
Personal tools