From 9b10de412ea40a474c82049b913fabc1fe02f40e Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Tue, 11 Jan 2022 17:26:51 +0100 Subject: [PATCH] Add Dirs in Pagination --- index.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 83a0926..7e3c826 100644 --- a/index.php +++ b/index.php @@ -76,6 +76,7 @@ if (isset($_GET['f'])) { // Sort and Reverse Filelist natcasesort($files); $files = array_reverse($files); +$files = array_merge($dirs, $files); // Get Files for current Page $curfiles = array_slice($files, ($page-1)*$slice ,$slice, true); @@ -100,13 +101,17 @@ if (!empty($curfiles)| !empty($dirs)) { if ($slice > 1) { if (!empty($curfiles)) { foreach ($curfiles as $index => $image) { - $tmp['n'] = $image; - $tmp['i'] = $index+1; - $tmp['t'] = $thumburl.$t->get_thumb($image); - $data['images'][] = $tmp; + if (in_array($image, $dirs)) { + $data['dirs'][] = $image; + } else { + $tmp['n'] = $image; + $tmp['i'] = $index+1; + $tmp['t'] = $thumburl.$t->get_thumb($image); + $data['images'][] = $tmp; + } } } - $data['dirs'] = $dirs; + Template::view('tpl/gallery.html', $data); } else { $data['gallery_page'] = ceil($page/$gslice);