Re: [kcmedia] Gallery Link Issue
Hi Craig,
There are a couple of things happening here. First, the only time you're selecting your galleries is in the query where you're selecting all you galleries to display the links.
When you're actually showing images, you're using the variable $record. The only place this is being set is in the foreach loop above it where you're outputting your galleries. You're probably finding that the images being displayed are always from "Gallery 2". This is because this is the last value $record had when in the foreach loop.
The first thing you need to do is get a variable with the gallery you want to display in it.
In awardwinningbathrooms.php add this highlighted code:
// load records
list($galleryRecords, $galleryMetaData) = getRecords(array(
'tableName' => 'gallery',
'limit' => '15',
'allowSearch' => 0,
// 'where' => whereRecordNumberInUrl(1),
));
$displayGallery = $galleryRecords[0];
And in awardwinningbathroomDetails.php add this highlighted code:
// load records
list($galleryRecords, $galleryMetaData) = getRecords(array(
'tableName' => 'gallery',
'limit' => '15',
'allowSearch' => true,
// 'where' => whereRecordNumberInUrl(1),
));
list($displayGallery,)=getRecords(array(
'tableName' => 'gallery',
'limit' => 1,
'allowSearch' => false,
'where' => whereRecordNumberInUrl(1),
));
$displayGallery=$displayGallery[0];
Finally, change your code where you're displaying your gallery like this (this should be the same on both pages:
<h2>Our <span>Gallery</span></h2>
<div> <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($displayGallery['images'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[screenshots]" ><img src="<?php echo $upload['thumbUrlPath2'] ?>" alt="" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" border="0" /></a>
<?php break ?>
<?php endforeach ?><br /><br />
<!-- STEP2a: /Display Uploads -->
<?php foreach ($displayGallery['images'] as $upload): ?>
<?php if (@++$count == 1) { continue; } ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[screenshots]" ><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="100" height="100" vspace="13" border="0" /></a>
<?php endforeach ?>
Give this a try and let me know if you run into any other problems.
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/