public function index() { parent::index(); $album = empty($this->parameters) ? "" : array_shift($this->parameters); $dir = new \RecursiveDirectoryIterator(dirname(__DIR__) . $this->basedir . $album); if (empty($album)) { $albums = array(); foreach ($dir as $name => $object) { $shortname = basename($name); if ($shortname != ".." && $shortname != ".") { $temp_album = new \DirectoryIterator($name); foreach ($temp_album as $img) { if ($img->isFile()) { break; } } $albums[$dir->getCTime()] = array("name" => $shortname, "image" => $this->basedir . $shortname . "/" . $img, "link" => "/fotos/index/" . $shortname); } } ksort($albums); $this->context["albums"] = $albums; } else { $pictures = array(); foreach ($dir as $image) { $shortname = basename($image); if ($shortname != ".." && $shortname != ".") { $pictures[] = $this->basedir . $album . "/" . $shortname; } } $this->context["pictures"] = $pictures; $this->context["album"] = $album; } }