summaryrefslogtreecommitdiff
path: root/src/partials.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-30 00:17:39 +0500
committerilotterytea <iltsu@alright.party>2025-04-30 00:17:39 +0500
commit6e27fb9de11843b7bb605fe85cb628b6e4882787 (patch)
treec4e3cf3cbf705267b24bc5ddf1fcd355b4441b56 /src/partials.php
parent8d6cb83506bcaa6b48aa1b24c31678a83b69374b (diff)
feat: PAGination!
Diffstat (limited to 'src/partials.php')
-rw-r--r--src/partials.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/partials.php b/src/partials.php
index 0b21b50..9b02a7b 100644
--- a/src/partials.php
+++ b/src/partials.php
@@ -94,4 +94,27 @@ function html_navigation_search()
</div>
</section>
<?php ;
+}
+
+function html_pagination(int $total_pages, int $current_page, string $redirect)
+{
+ if (str_contains($redirect, "?")) {
+ $redirect .= "&p=";
+ } else {
+ $redirect .= "?p=";
+ }
+
+ if ($total_pages > 1) {
+ echo '' ?>
+ <div class="pagination">
+ <?php if ($current_page > 1): ?>
+ <a href="<?php echo $redirect . ($current_page - 1) ?>">[ prev ]</a>
+ <?php endif; ?>
+ <?php if ($current_page < $total_pages): ?>
+ <a href="<?php echo $redirect . ($current_page + 1) ?>">[ next ]</a>
+ <?php endif; ?>
+
+ </div>
+ <?php ;
+ }
} \ No newline at end of file