TheTangentBundleTheTangentBundle
Welcome to the chatterbox... 
TheTangentBundle forumspace!

Browsing How to

Hacking page titles on MediaWiki

  del.icio.us logo Digg logo reddit logo google logo Yahoo logo technorati logo
  [ party mode ]



(1)

How to churn your own butterHow to poach an egg perfectly
 
Dirtysouthafrican (2)Hacking page titles on MediaWiki - 2007-03-26 20:15:20
Avatar of user Dirtysouthafrican
Registered: unknown
Posts: 388

This is not terribly enlightening but I wanted MediaWiki 1.9.2 to show only the lowest level subpage name rather than /the/entire/hierarchy, since my installation makes heavy use of the subpage feature. Thus, I edited Article.php to look like the following:


/* title may have been set from the cache */
$t = $wgOut->getPageTitle();
if( empty( $t ) ) {
    $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
}

# Replace title for subpage feature
# Author: Lionel Brits
# Date: March 26, 2007
# Email: lionelbrits@gmail.com
$wgOut->setPageTitleWithSubpages( $wgOut->getPageTitle(), $this->mTitle->getSubpageText() );
# Replace the above line with the following if you want the HTML title and page title to be the same; Editing OutputPage.php is then unnecessary.
# $wgOut->setPageTitle( $this->mTitle->getSubpageText() );

and added the following member to the OutputPage class in OutputPage.php


public function setPageTitleWithSubpages($fullname,$name)
{
    $this->setPageTitle( $name);
    $this->setHTMLTitle( wfMsg( 'pagetitle', $fullname ) );
}

In the mean time I'll try to figure out how to do this as an extension.


 
You need to log in in order to reply to this topic.
generated:November 21, 2008, 10:51 am
Generated on November 21, 2008, 10:51 am



© 2008 Lionel Brits

This page validates as XHTML 1.1 RSS 2.0 posts Green Web Hosting! This site hosted by DreamHost.


Theme © 2006 Lionel Brits