Add Dirs in Pagination
This commit is contained in:
parent
9947f2b706
commit
9b10de412e
1 changed files with 10 additions and 5 deletions
15
index.php
15
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);
|
||||
|
|
Loading…
Reference in a new issue