Suppress display of duplicate getCategoryBottom() if there are no category members...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 20 Jun 2009 09:21:33 +0000 (09:21 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 20 Jun 2009 09:21:33 +0000 (09:21 +0000)
Cannot know if completely suppressing this is possible (and show 'category-empty'), because 'until' or 'from' can be set and previous/next *may* give results). Adding a FIXME for that.

includes/CategoryPage.php

index f431045..3f3f67c 100644 (file)
@@ -95,11 +95,22 @@ class CategoryViewer {
                $this->doCategoryQuery();
                $this->finaliseCategoryState();
 
-               $r = $this->getCategoryTop() .
-                       $this->getSubcategorySection() .
+               $r = $this->getSubcategorySection() .
                        $this->getPagesSection() .
-                       $this->getImageSection() .
-                       $this->getCategoryBottom();
+                       $this->getImageSection();
+
+               if( $r == '' ) {
+                       // If there is no category content to display, only
+                       // show the top part of the navigation links.
+                       // FIXME: cannot be completely suppressed because it
+                       //        is unknown if 'until' or 'from' makes this
+                       //        give 0 results.
+                       $r = $r . $this->getCategoryTop();
+               } else {
+                       $r = $this->getCategoryTop() .
+                               $r .
+                               $this->getCategoryBottom();
+               }
 
                // Give a proper message if category is empty
                if ( $r == '' ) {