reusable single photo function
authorAndreas Unterkircher <unki@netshadow.at>
Mon, 4 Jun 2007 20:11:02 +0000 (20:11 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Mon, 4 Jun 2007 20:11:02 +0000 (20:11 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@14 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php

index 1dd3b9369e33f87d377c83fb2a624fd863ce1072..1a344f465e66bd1b75b01a3a138e03bf59b1c4bb 100644 (file)
@@ -20,7 +20,7 @@ class PHPFSPOT {
       $this->cfg = new PHPFSPOT_CFG;
 
       $this->db = new PHPFSPOT_DB(&$this, $this->cfg->db);
       $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();
 
       $this->get_tags();
       $this->get_photos();
@@ -37,18 +37,8 @@ class PHPFSPOT {
 
    public function show()
    {
 
    public function show()
    {
-      if(isset($this->current_photo)) {
-         $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$this->current_photo] ."&amp;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");
 
       $this->tmpl->assign('tags', $this->tags);
       $this->tmpl->show("index.tpl");
 
@@ -119,6 +109,22 @@ class PHPFSPOT {
 
    } // translate_path
 
 
    } // translate_path
 
+   public function prepare_single_photo($photo)
+   {
+      if(isset($photo)) {
+         $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$photo] ."&amp;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()
+
 }
 
 ?>
 }
 
 ?>