From: Andreas Unterkircher Date: Mon, 4 Jun 2007 20:11:02 +0000 (+0000) Subject: reusable single photo function X-Git-Tag: phpfspot-1.2~321 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=7a8bacbb65ce47c96fb30144f1a06d9d9a17c319 reusable single photo function git-svn-id: file:///var/lib/svn/phpfspot/trunk@14 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- diff --git a/phpfspot.class.php b/phpfspot.class.php index 1dd3b93..1a344f4 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -20,7 +20,7 @@ class PHPFSPOT { $this->cfg = new PHPFSPOT_CFG; $this->db = new PHPFSPOT_DB(&$this, $this->cfg->db); - $this->tmpl = new PHPFSPOT_TMPL(&$this); + $this->tmpl = new PHPFSPOT_TMPL($this); $this->get_tags(); $this->get_photos(); @@ -37,18 +37,8 @@ class PHPFSPOT { public function show() { - if(isset($this->current_photo)) { - $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$this->current_photo] ."&width=". $this->cfg->photo_width); - } - - if($this->current_photo > 0) { - $this->tmpl->assign('previous_url', "javascript:showImage(". ($this->current_photo-1) .");"); - } - - if($this->current_photo < count($this->avail_photos)) { - $this->tmpl->assign('next_url', "javascript:showImage(". ($this->current_photo+1) .");"); - } + $this->prepare_single_photo($this->current_photo); $this->tmpl->assign('tags', $this->tags); $this->tmpl->show("index.tpl"); @@ -119,6 +109,22 @@ class PHPFSPOT { } // translate_path + public function prepare_single_photo($photo) + { + if(isset($photo)) { + $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$photo] ."&width=". $this->cfg->photo_width); + } + + if($photo > 0) { + $this->tmpl->assign('previous_url', "javascript:showImage(". ($photo-1) .");"); + } + + if($photo < count($this->avail_photos)) { + $this->tmpl->assign('next_url', "javascript:showImage(". ($photo+1) .");"); + } + + } // prepare_single_photo() + } ?>