diff options
-rw-r--r-- | phpfspot.class.php | 30 |
1 files changed, 18 insertions, 12 deletions
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() + } ?> |