Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php gallery with lightbox 2.0 1

Status
Not open for further replies.

rahulpatel

Programmer
Jan 20, 2007
33
AU
I hope some of you out there can shed some light on a problem for me. Hopefully this won't be as stupidly easy as my last 'problem'.

So, I have a dynamically created gallery and I decided to incorporate lightbox 2.0 into it. This is the section that creates the gallery.

Code:
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?image=<?php echo $row['filename']; ?>&amp;curPage=<?php echo $curPage; ?>" [B]rel="lightbox"[/B]><img src="../images/thumbs/<?php echo $row['filename'];  ?>"  alt="<?php echo $row['caption']; ?>" width="80" height="54" /></a></td>

without the rel="lightbox" the gallery runs as it should. With the rel="lightbox" included the script runs but it doesn't show the image. So, I tried copying and pasting the html that was generated into a static page. This is what was generated with a single image in the image folder.

Code:
<td><a href="mywebsite/site/gallery.php?image=image.jpg" rel="lightbox"><img src="images/image.jpg"  alt="My first image" width="80" height="54" /></a></td>
                                    </tr>
This doesn't work. However if I replace mywebsite/site/gallery.php?image= with ../ it works fine. But I don't want to manually change all the code.

Are there any ideas out there why it doesn't work?
 
i'm very confused as to how a hard coded value (pretty much) for the path in the php can become something different in the html. somehow the 'thumbs' part of the path is missing from the html. i suspect that this means that you have not copied and pasted the code accurately into this thread; meaning that any advice we give will be based on incorrect initial data.
 
Thanks for replying. I think everyone else hasn't stopped laughing at such an easy answer. Anyway, as with most times I post on here I eventually figure it.

I changed this:
Code:
<a href="<?php echo $_SERVER['PHP_SELF']; ?>

to:
Code:
<a href="../images/<?php echo $row['filename']; ?>"

and it works like I paid someone to code it for me!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top