ceil(count($files)/$slice)) $data['next_page'] = $page; $data['last_page'] = ceil(count($files)/$slice); // Prepare Mode Specific Data and Render Template if ($slice > 1) { foreach ($curfiles as $index => $image) { $tmp['n'] = $image; $tmp['i'] = $index+1; $tmp['t'] = $thumburl.$t->get_thumb($image); $data['images'][] = $tmp; } Template::view('tpl/gallery.html', $data); } else { $data['gallery_page'] = ceil($page/$gslice); $data['gallery_slice'] = $gslice; foreach ($curfiles as $index => $image) { $data['imageurl'] = $imageurl.$dir.'/'.$image; $data['imagename'] = $image; $data['tags'] = explode(" ", pathinfo(trim(strstr(strtolower($image), ' - '), " -"))['filename']); } Template::view('tpl/single.html', $data); } ?>