Gallery Link Issue

10 posts by 3 authors in: Forums > CMS Builder
Last Post: October 27, 2010   (RSS)

By KCMedia - October 23, 2010

Hi

I have setup a gallery and i am having issues when you click on the links to show other pages and galleries

this is the link to the page

http://www.awardbathrooms.com.au/awardwinningbathrooms.php

It will load the first page ok with the images but when you click on the links on the left it will not load all of the pages and i can not work out why.

also find attached the code for the pages.

thank you

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Gallery Link Issue

Hi Craig,

Just a quick idea that you probably tried already, but sometimes the occurance of 'where' => whereRecordNumberInUrl(1), can trip up how pages are displayed.

Good luck,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [kcmedia] Gallery Link Issue

By Jason - October 25, 2010

Hi Craig,

I believe Jerry is right. The problem seems to be here:

list($google_analyticsRecords, $google_analyticsMetaData) = getRecords(array(
'tableName' => 'google_analytics',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$google_analyticsRecord = @$google_analyticsRecords[0]; // get first record


You're using the whereRecordNumberInUrl() function, which worked fine on the first page when the record number was 1. If there isn't a record 2 in the google_analytics table, then this would be whey the page isn't loading.

If there is only 1 record in google_analytics that you want to pull out, try this code:

list($google_analyticsRecords, $google_analyticsMetaData) = getRecords(array(
'tableName' => 'google_analytics',
'allowSearch' => false,
'limit' => '1',
));
$google_analyticsRecord = @$google_analyticsRecords[0]; // get first record


This will just pull out the first record in that table.

You'll want to take a look at the other tables you're doing this on (gallery_metatags and gallery_wording) since you're trying to get these records all based on the same record number.

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/

Re: [Jason] Gallery Link Issue

By KCMedia - October 25, 2010

Hi Jason

Still not working right.

when you first go to the gallery it should show the first gallery in the list and all the pictures to do with that gallery and on the left there should be a complete list of the galleries in that section and when you click on them they will show that gallery.

But that dosnt work and i have made the changes you said find attached pages.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Gallery Link Issue

By Jason - October 26, 2010

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/

Re: [Jason] Gallery Link Issue

By KCMedia - October 26, 2010

Hi Jason

It is getting better but still not 100% when you go to the gallery page it will load images ok but when you click on the left hand side say gallery 2 it will load images but when you click on gallery 1 it will show the main image as gallery 2 image and not gallery 1 main image.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Gallery Link Issue

By Jason - October 27, 2010

Hi Craig,

On your page where you're displaying the main image, did you change the code to look like this:
<!-- 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 />


If so and it's still not working, please attach your most recent versions of these files and I'll take a look.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Gallery Link Issue

By KCMedia - October 27, 2010

Hi Jason

Yes it is correct from what i can see.

Just to make sure we both on the right track.

When i first load the awarwinningbathrooms.php page it should show the thumbnail2 for the first gallery in the section and then when you click on the next gallery link or any other gallery for that fact that it should show that main image for that gallery on the awardwinningbathroomsDetail.php page and then when you click another gallery it should show its main image.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Gallery Link Issue

By Jason - October 27, 2010

Hi Craig,

The change was made in awardwinningbathrooms.php but not in awardwinningbathroomsDetail.php.

In that file you need to make the same change to where the main image is displayed as follows:

<!-- 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 />


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/