* (bug 8132) Suppress "Pages in this category" heading in categories when there are...
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 22 Feb 2007 15:01:45 +0000 (15:01 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 22 Feb 2007 15:01:45 +0000 (15:01 +0000)
RELEASE-NOTES
includes/CategoryPage.php

index 0fff2d3..8ca28dd 100644 (file)
@@ -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 ==
 
index 13610a9..7fd3dbb 100644 (file)
@@ -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 .= "<div id=\"mw-subcategories\">\n";
                        $r .= '<h2>' . wfMsg( 'subcategories' ) . "</h2>\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</div>";
                }
@@ -253,11 +254,16 @@ class CategoryViewer {
 
        function getPagesSection() {
                $ti = htmlspecialchars( $this->title->getText() );
-               $r = "<div id=\"mw-pages\">\n";
-               $r .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
-               $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), count( $this->articles) );
-               $r .= $this->formatList( $this->articles, $this->articles_start_char );
-               $r .= "\n</div>";
+               # Don't show articles section if there are none.
+               $r = '';
+               $c = count( $this->articles );
+               if( $c > 0 ) {
+                       $r = "<div id=\"mw-pages\">\n";
+                       $r .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
+                       $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), $c );
+                       $r .= $this->formatList( $this->articles, $this->articles_start_char );
+                       $r .= "\n</div>";
+               }
                return $r;
        }