From 3ffe4a865103978287fe6236cd0947ebe57bb1f3 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 28 Aug 2023 17:30:17 +0300 Subject: [PATCH] implement pagination --- .../assets/theme/default/css/common.css | 13 +++++++++ .../assets/theme/default/css/framework.css | 4 +++ src/public/index.php | 27 +++++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/public/assets/theme/default/css/common.css b/src/public/assets/theme/default/css/common.css index 9a0ac6b..2919dfb 100644 --- a/src/public/assets/theme/default/css/common.css +++ b/src/public/assets/theme/default/css/common.css @@ -77,4 +77,17 @@ header a.logo { header a.logo > span { color: #96d9a1; +} + +a.button, +a.button:visited, +a.button:active, +a.button:hover, +.button { + background: #5d627d; + color: #ccc; + border: 0; + border-radius: 3px; + padding: 6px 8px; + font-size: 13px; } \ No newline at end of file diff --git a/src/public/assets/theme/default/css/framework.css b/src/public/assets/theme/default/css/framework.css index c48f7c6..f0b593a 100644 --- a/src/public/assets/theme/default/css/framework.css +++ b/src/public/assets/theme/default/css/framework.css @@ -156,6 +156,10 @@ padding: 16px; } +.margin-l-4 { + margin-left: 4px; +} + .margin-l-8 { margin-left: 8px; } diff --git a/src/public/index.php b/src/public/index.php index fb1f8a0..a58979c 100644 --- a/src/public/index.php +++ b/src/public/index.php @@ -76,12 +76,12 @@ else } // Get index - $total = $sphinx->searchMagnetsTotal($request->query); + $response->total = $sphinx->searchMagnetsTotal($request->query); $results = $sphinx->searchMagnets( $request->query, $request->page * WEBSITE_PAGINATION_LIMIT - WEBSITE_PAGINATION_LIMIT, WEBSITE_PAGINATION_LIMIT, - $total + $response->total ); foreach ($results as $result) @@ -413,6 +413,29 @@ echo '' . PHP_EOL ?> + total > WEBSITE_PAGINATION_LIMIT) { ?> +
+
+ page, ceil($response->total / WEBSITE_PAGINATION_LIMIT)) ?> + page > 1) { ?> + + + + + page < ceil($response->total / WEBSITE_PAGINATION_LIMIT)) { ?> + + + + +
+
+