issue20, use <a>-anchor to directly jump to the right photo in photo index view
authorAndreas Unterkircher <unki@netshadow.at>
Sun, 1 Jul 2007 11:58:41 +0000 (11:58 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Sun, 1 Jul 2007 11:58:41 +0000 (11:58 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@156 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php
templates/photo_index.tpl

index 980dc818a09ed510a3d62e6a2f0f727594b9788b..ca5f7b4a6e5d56ecd320084adc7102e6bb0c5664 100644 (file)
@@ -399,6 +399,8 @@ class PHPFSPOT {
 
       $count = count($photos);
 
+      $anchor = $_SESSION['begin_with'];
+
       if(!isset($this->cfg->rows_per_page) || $this->cfg->rows_per_page == 0) {
 
          $begin_with = 0;
@@ -435,10 +437,12 @@ class PHPFSPOT {
       $images[$rows] = Array();
       $img_height[$rows] = Array();
       $img_width[$rows] = Array();
+      $img_id[$rows] = Array();
 
       for($i = $begin_with; $i < $end_with; $i++) {
 
          $images[$rows][$cols] = $photos[$i];
+         $img_id[$rows][$cols] = $i;
 
          $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->thumb_width ."_". $this->getMD5($photos[$i]);
 
@@ -535,10 +539,13 @@ class PHPFSPOT {
       $this->tmpl->assign('images', $images);
       $this->tmpl->assign('img_width', $img_width);
       $this->tmpl->assign('img_height', $img_height);
+      $this->tmpl->assign('img_id', $img_id);
       $this->tmpl->assign('rows', $rows);
       $this->tmpl->assign('columns', $this->cfg->thumbs_per_row);
+
       $this->tmpl->show("photo_index.tpl");
 
+      print "<script language=\"JavaScript\">self.location.hash = '#image". $anchor ."';</script>\n";
 
    } // showPhotoIndex()
 
index 57cf2ff1f7126e8511ae108759142cdc5ea81993..ee11a4f15516225be236241194da80b6fd67fbe6 100644 (file)
@@ -39,7 +39,7 @@
       {if $images[row][col] }
       <div id="outter">
       <div id="inner">
-       <a href="javascript:showImage({$images[row][col]});" id="{$images[row][col]}">
+       <a href="javascript:showImage({$images[row][col]});" id="{$images[row][col]}" name="image{$img_id[row][col]}">
         <img class="thumb" id="{$images[row][col]}" src="phpfspot_img.php?idx={$images[row][col]}&amp;width={$width}" alt="thumb_{$images[row][col]}" width="{$img_width[row][col]}" height="{$img_height[row][col]}" />
        </a>
       </div>