Fix post pagebreak

Before, the older entries button showed if the amount of posts
was equal to the pagesize, even though there were no more entries
to be shown after clicking the button.
This commit is contained in:
Markus Koch 2018-04-30 09:42:53 +02:00
parent 6ba274cbea
commit e8827ce7d4

View File

@ -249,7 +249,7 @@
$CMS_SINGLE_POST = true; $CMS_SINGLE_POST = true;
} }
$i = 0; $i = 0;
$morePosts = false; $morePosts = 0;
foreach($posts as $k=>$v) { foreach($posts as $k=>$v) {
if ($v->isPublic) { if ($v->isPublic) {
if (!isset($tagSearch) || in_array($tagSearch, $v->tags)) { if (!isset($tagSearch) || in_array($tagSearch, $v->tags)) {
@ -277,8 +277,14 @@
echo '<hr class="postSeparator">'; echo '<hr class="postSeparator">';
} }
if (($i % POSTS_PAGE_SIZE) == 0) { if (($i % POSTS_PAGE_SIZE) == 0) {
$morePosts = true; $morePosts = 1;
} else {
if ($morePosts == 1) {
$morePosts = 2;
break; break;
} else {
$morePosts = 0;
}
} }
} }
} }