close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Lightbox and PHP

Thread began 1/05/2010 3:22 pm by troyd | Last modified 1/10/2010 1:21 am by troyd | 2494 views | 2 replies |


Lightbox and PHP

Has anyone tried to include the Lightbox2 using the Prototype framework to display images in a repeating region?

What I have here is a repeating table of records created with DataAssist. That all works fine. There are 3 images within each record. Right now if you click on an image thumbnail it pops up a detailed large version of the image. But then you have to close that window and click on each of the other two thumbnails one at a time to see them.

My customer wants the lightbox instead so that he can click next to see all three images in that record.

With Lightbox2 there is the rel="lightbox[group]" that allows you to show only groups with a particular name. But I can not figure out how to create this dynamically. And since the thumbnails are each in their own column of the database table, it shows the first image of each record when you click on imagethumb1.

My current code that pops up the lightbox, but shows the image1 of all records is this;

<a href="images/<?php echo $row_rsAvailable['image1']; ?>"
rel="lightbox[group]" title="<?php echo $row_rsAvailable['number']; ?>">
<img src="images/<?php echo $row_rsAvailable['image1']; ?>"
alt="Available" width="150" /></a>

So I somehow need to first echo all images in that record (image1, image2, image3). Then I need to pass the group name in the form of the id of that record. Any thoughts on doing this?


Sign in to reply to this post


Hey Troy,

First, you are right on with the repeat region, but you need to alter the name of the group based on sets of threes... so a little modulo operation will be needed along with a system to increment for each group.

<!-- First set the group increment number -->

<?php $groupincrement 1?>

<!-- Now set the row increment number (after every third row will later increase the group increment number by 1) -->

<?php $rowincrement 1?>

<!-- Now, begin the loop -->

<?php do { ?>

<a href="images/<?php echo $imagename?>" rel="lightbox[group<?php echo $groupincrement?>]"><?php echo $row_image['imagename']; ?></a>

<!-- We will now increase the row increment -->
<?php ++$rowincrement?>

<!-- We will now test the row to see if it is the third item and if it is, we will add an increment to the group -->

<?php if ($rowincrement == 0) {

<?php  } while condition met ?>

Best regards,


Sign in to reply to this post


As always Brian, you gave a great and detailed response. THANKS!

I will give it a try and report back.

Thanks again,

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...