From b443b024b0e27f4521cb920d231f45e483168dae Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Thu, 22 Feb 2007 15:01:45 +0000 Subject: [PATCH] * (bug 8132) Suppress "Pages in this category" heading in categories when there are none --- RELEASE-NOTES | 2 ++ includes/CategoryPage.php | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0fff2d3b90..8ca28ddc4e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -224,6 +224,8 @@ lighter making things easier to read. rows to list for query pages * (bug 9057) Standardize MediaWiki: namespace for oc * (bug 9032) Make quickbarSettings localizable through Special:Allmessages +* (bug 8132) Suppress "Pages in this category" heading in categories when + there are none == Languages updated == diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 13610a9e68..7fd3dbb4f9 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -240,11 +240,12 @@ class CategoryViewer { function getSubcategorySection() { # Don't show subcategories section if there are none. $r = ''; - if( count( $this->children ) > 0 ) { + $c = count( $this->children ); + if( $c > 0 ) { # Showing subcategories $r .= "
\n"; $r .= '

' . wfMsg( 'subcategories' ) . "

\n"; - $r .= wfMsgExt( 'subcategorycount', array( 'parse' ), count( $this->children) ); + $r .= wfMsgExt( 'subcategorycount', array( 'parse' ), $c ); $r .= $this->formatList( $this->children, $this->children_start_char ); $r .= "\n
"; } @@ -253,11 +254,16 @@ class CategoryViewer { function getPagesSection() { $ti = htmlspecialchars( $this->title->getText() ); - $r = "
\n"; - $r .= '

' . wfMsg( 'category_header', $ti ) . "

\n"; - $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), count( $this->articles) ); - $r .= $this->formatList( $this->articles, $this->articles_start_char ); - $r .= "\n
"; + # Don't show articles section if there are none. + $r = ''; + $c = count( $this->articles ); + if( $c > 0 ) { + $r = "
\n"; + $r .= '

' . wfMsg( 'category_header', $ti ) . "

\n"; + $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), $c ); + $r .= $this->formatList( $this->articles, $this->articles_start_char ); + $r .= "\n
"; + } return $r; } -- 2.20.1