From 89df78ec8185fcd6dc876c042f10331449e9fa8c Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 6 Jun 2004 02:49:47 +0000 Subject: [PATCH] Enable links in the dmoz-like category browser --- includes/Skin.php | 4 ++-- includes/Title.php | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 81d1f2c138..1d72b69c9f 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -360,7 +360,7 @@ class Skin { function getCategoryLinks () { global $wgOut, $wgTitle, $wgUser, $wgParser; - global $wgUseCategoryMagic; + global $wgUseCategoryMagic, $wgLang; if( !$wgUseCategoryMagic ) return "" ; if( count( $wgOut->mCategoryLinks ) == 0 ) return ""; if( !$wgOut->isArticle() ) return ""; @@ -375,7 +375,7 @@ class Skin { $wgTitle->getAllParentCategories(&$catstack); foreach ($catstack as $key => $cat) { - $s .= $key." > ".$cat."
\n"; + $s .= $this->makeLink($wgLang->getNSText( Namespace::getCategory() ).":".$key, $key )." > ".$cat."
\n"; } return $s; diff --git a/includes/Title.php b/includes/Title.php index 48ac5bf0a6..cc5be068ef 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1197,6 +1197,9 @@ class Title { # will get the parents and grand-parents function getAllParentCategories(&$stack) { + global $wgUser; + $sk =& $wgUser->getSkin() ; + # getting parents $parents = $this->getParentCategories( ); @@ -1205,10 +1208,13 @@ class Title { # create a title object for the parent $tpar = Title::newFromID($parent->cur_id); - $stack[$tpar->getText()] = $this->getText(); if(isset($stack[$this->getText()])) { + $stack[$tpar->getText()] = $sk->makeLink( $this->getPrefixedDBkey(), $this->getText() ); $stack[$tpar->getText()] .= " > ".$stack[$this->getText()]; + } else { + # don't make a link for current page + $stack[$tpar->getText()] = $this->getText(); } unset( $stack[$this->getText()] ); -- 2.20.1