aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/home.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-07-02 20:17:42 +0200
committerThomas Lange <code@nerdmind.de>2021-07-02 20:17:42 +0200
commitf5f94531c9d5b369fdf9c287f63c41476496e5ee (patch)
tree54aa2e26a044dca2d1f3604a920f1527c34e9021 /core/include/home.php
parent3939dc93d0c11438e8a3e44c48aab2f37128eebc (diff)
downloadblog-f5f94531c9d5b369fdf9c287f63c41476496e5ee.tar.gz
blog-f5f94531c9d5b369fdf9c287f63c41476496e5ee.tar.xz
blog-f5f94531c9d5b369fdf9c287f63c41476496e5ee.zip
Add generic function to create pagination template
This commit adds and uses the new function createPaginationTemplate to create the generic pagination template for various entity lists. This function replaces the many old confusing functions: * generateNaviTemplate * generatePageNaviTemplate * generatePostNaviTemplate * generateUserNaviTemplate * generateCategoryNaviTemplate * generateCategoryPostNaviTemplate
Diffstat (limited to 'core/include/home.php')
-rw-r--r--core/include/home.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/include/home.php b/core/include/home.php
index bc73bef..2893f0e 100644
--- a/core/include/home.php
+++ b/core/include/home.php
@@ -19,11 +19,18 @@ foreach($posts as $Post) {
}
#===============================================================================
+# Pagination
+#===============================================================================
+$count = $PostRepository->getCount();
+$lastSite = ceil($count / Application::get('POST.LIST_SIZE'));
+
+#===============================================================================
# Build document
#===============================================================================
$HomeTemplate = Template\Factory::build('home');
$HomeTemplate->set('PAGINATION', [
- 'HTML' => generatePostNaviTemplate(1)
+ 'HTML' => createPaginationTemplate(
+ 1, $lastSite, Application::getPostURL())
]);
$HomeTemplate->set('LIST', [
'POSTS' => $templates ?? []