summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2007-06-04 20:11:02 +0000
committerAndreas Unterkircher <unki@netshadow.at>2007-06-04 20:11:02 +0000
commit7a8bacbb65ce47c96fb30144f1a06d9d9a17c319 (patch)
treead45372a612e7d012b3cc4bbd3e19b34033c21b1
parent01d597aa4940beb0af2404096e2a1abdf1582f3a (diff)
reusable single photo function
git-svn-id: file:///var/lib/svn/phpfspot/trunk@14 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r--phpfspot.class.php30
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] ."&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");
@@ -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] ."&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()
+
}
?>