Lightbox2 - caption not being seen properly

Hey guys,

i followed this tutorial, http://www.huddletogether.com/projects/lightbox2/
and i am having problem in displaying my caption description. The problem is that when i try to click on my images, i don’t see my caption, sometimes when i click another image i do see my caption, but when i click another image, the caption that i last saw is presented on the current image that i’m seeing now. Here is my code:


			    <?php 
			     if( isset($images) )
			    {
 				   $step = 2;  
				   // Big for loop represents 1 whole image
				   for($i = 0; $i < count($images); $i+=$step)
				   {
					  
					  for($j = 0; $j < $step; $j++)
					  {
							
 						 if(isset($images[$i+$j]) )
						 {	echo '<div class="thumb">'; 
							echo '<a href="./images/'.$images[$i+$j]['Filename'].'" title="'.$images[$i+$j]['Description'].'" rel="lightbox">
                            <img src="./images/'.$images[$i+$j]['Filename'].'" width="150" height="100"   alt="'.$images[$i+$j]['Description'].'">';	
							 echo '</a>';
							
							echo '<div class="caption">';
							echo '<a href="./images/'.$images[$i+$j]['Filename'].'" rel="lightbox"><b>Description:</b>'.$images[$i+$j]['Description'].'</a></div>';
							   
							echo '</div>';
							
						 }
					  }
				      
				   }   	    
			    }
			    ?> 



I was not sure if this thread should be on the design section since it iinvolves lighbox, but i’m presenting the above code as php/html.

Please help if you can

Can you please elaborate?

I think you are talking about the image caption or image title?
If yes

try this

<?php
if( isset($images) )
{
$step = 2; // Big for loop represents 1 whole image
for($i = 0; $i < count($images); $i+=$step)
{
for($j = 0; $j < $step; $j++)
{
if(isset($images[$i+$j]) )
{
echo ‘<div class=“thumb”>’;
echo ‘<a href="./images/’.$images[$i+$j][‘Filename’].‘" title="’.$images[$i+$j][‘Description’].‘" rel=“lightbox”>
<img src="./images/’.$images[$i+$j][‘Filename’].‘" width=“150” height=“100” alt="’.$images[$i+$j][‘Description’].‘">’;
echo ‘</a>’;
echo ‘<div class=“caption”>’;
echo ‘<a href="./images/’.$images[$i+$j][‘Filename’].‘" title="'.$images[$i+$j][‘Description’]. rel=“lightbox”><b>Description:</b>’.$images[$i+$j][‘Description’].‘</a></div>’;
echo ‘</div>’;
}
}
}
} ?>

hi, yes image caption, my apologise. It seems to work now, when i click the actual image it display the image caption fine. However, when i click the image caption, as seen the link given, http://img713.imageshack.us/i/imagelink.jpg/

it seems to now display the image in a new window. Any reason why? I think i had this problem before but i can’t remember how i did it.

Update code:


 for($j = 0; $j < $step; $j++)
                      {
                            
                          if(isset($images[$i+$j]) )
                         if(isset($images[$i+$j]) )
                         {    echo '<div class="thumb">'; 
                            echo '<a href="./images/'.$images[$i+$j]['Filename'].'" title="'.$images[$i+$j]['Description'].'" rel="lightbox">
                            <img src="./images/'.$images[$i+$j]['Filename'].'" width="150" height="100"   alt="'.$images[$i+$j]['Description'].'">';    
                             echo '</a>';
                            
                            echo '<div class="caption">';
 echo '<a href="./images/'.$images[$i+$j]['Filename'].'" title="'.$images[$i+$j]['Description'].'"><b>Description:</b>'.$images[$i+$j]['Description'].'</a></div>';
                               
                            echo '</div>';
                            
                         }
                      }


UPDATE. I solved the issue, i realised that the HTML code was wrong so i the html is now:



  <div class="thumb"><a href="./images/IMG_0281.jpg" title="Garden area" rel="lightbox">
   <img src="./images/IMG_0281.jpg" width="150" height="100"   alt="Garden area"></a><
div class="caption"><a href="./images/IMG_0281.jpg" title="Garden area"rel="lightbox"><b>Description:</b>Garden area</a>
</div></div>

with the corresponding PHP code:


					  for($j = 0; $j < $step; $j++)
					  {
							
 						 if(isset($images[$i+$j]) )
						 {	echo '<div class="thumb">'; 
							echo '<a href="./images/'.$images[$i+$j]['Filename'].'" title="'.$images[$i+$j]['Description'].'" rel="lightbox">
                            <img src="./images/'.$images[$i+$j]['Filename'].'" width="150" height="100"   alt="'.$images[$i+$j]['Description'].'">';	
							 echo '</a>';
							
							echo '<div class="caption">';
							echo '<a href="./images/'.$images[$i+$j]['Filename'].'" title="'.$images[$i+$j]['Description'].'"rel="lightbox"><b>Description:</b>'.$images[$i+$j]['Description'].'</a></div>';
							   
							echo '</div>';
							
						 }// END IF
					  }// END INNER FOR


I knew it had to be my html but wasn’t sure initially, so i had to definitely play around it