Next and Previous using lightbox?

13 posts by 5 authors in: Forums > CMS Builder
Last Post: December 6, 2010   (RSS)

Re: [equinox69] Next and Previous using lightbox?

By Jason - December 6, 2010

Hi,

All you need to do is ensure that the photos for a particular product record has a unique group name. The easiest field to use would be the "num" field of the product record, since it will be unique across all records in the product table.

Here is a small example of how it would look. In this example, all the product records are stored in a variable called $productRecords and the products table has an upload field called photos:

<?php foreach($productRecords as $product): ?>
<?php foreach($product['photos'] as $photo): ?>
<a href="<?php echo $photo['urlPath'] ?>" rel="lightbox[<?php echo $product['num'];?>]" title="<?php echo $photo['info1'] ?>">
<img src="<?php echo $photo['thumbUrlPath'] ?>" width="<?php echo $photo['thumbWidth'] ?>" height="<?php echo $photo['thumbHeight'] ?>" alt="" title="<?php echo $photo['info1'] ?>" />
</a>
<?php endforeach ?>
<?php endforeach ?>


This will output all of the photos stored in each of the product records. The group name of each photo will be the record number of the product record they are associated with.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Codee - December 6, 2010

Jason,

YES! That's what I was thinking/trying to ask! Thank you for your patience and clarification.