From 32279afc6e5272bff0fd874667904d05bca4c614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 21 May 2013 09:10:05 +0200 Subject: [PATCH] Hide tags & series if there is none. re #63 --- base.php | 6 ++++-- index.php | 9 ++++++++- serie.php | 1 + tag.php | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/base.php b/base.php index a78c5e9..a91d954 100644 --- a/base.php +++ b/base.php @@ -377,8 +377,10 @@ class Page } } else { array_push ($this->entryArray, Author::getCount()); - array_push ($this->entryArray, Serie::getCount()); - array_push ($this->entryArray, Tag::getCount()); + $series = Serie::getCount(); + if (!is_null ($series)) array_push ($this->entryArray, $series); + $tags = Tag::getCount(); + if (!is_null ($tags)) array_push ($this->entryArray, $tags); foreach ($config['cops_calibre_custom_column'] as $lookup) { $customId = CustomColumn::getCustomId ($lookup); if (!is_null ($customId)) { diff --git a/index.php b/index.php index befbda3..681455a 100644 --- a/index.php +++ b/index.php @@ -247,7 +247,14 @@ ?> book->getRating () ?>

book->getAuthorsName ()) ?>
-

" . htmlspecialchars ($entry->book->getTagsName ()) ?>
+ book->getTagsName (); + if (!empty ($tags)) { + ?> +

" . htmlspecialchars ($tags) ?>
+ book->getSerie (); if (!is_null ($serie)) { diff --git a/serie.php b/serie.php index ec74416..668dbbc 100644 --- a/serie.php +++ b/serie.php @@ -29,6 +29,7 @@ class Serie extends Base { public static function getCount() { $nSeries = parent::getDb ()->query('select count(*) from series')->fetchColumn(); + if ($nSeries == 0) return NULL; $entry = new Entry (localize("series.title"), self::ALL_SERIES_ID, str_format (localize("series.alphabetical", $nSeries), $nSeries), "text", array ( new LinkNavigation ("?page=".parent::PAGE_ALL_SERIES))); diff --git a/tag.php b/tag.php index fe37cce..96c4987 100644 --- a/tag.php +++ b/tag.php @@ -29,6 +29,7 @@ class tag extends Base { public static function getCount() { $nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn(); + if ($nTags == 0) return NULL; $entry = new Entry (localize("tags.title"), self::ALL_TAGS_ID, str_format (localize("tags.alphabetical", $nTags), $nTags), "text", array ( new LinkNavigation ("?page=".parent::PAGE_ALL_TAGS)));