Photo Gallery- next/prev links not displaying images

17 posts by 2 authors in: Forums > CMS Builder
Last Post: September 22, 2011   (RSS)

By csdesign - September 9, 2011

Hello! I know this is a big fat user error on my part. Help would be really appreciated!

I have two editors for this gallery page:
"bird_photography_gallery" (single record for title & top-of-page description, title & content fields only)

"bird_photos" (multi-record for photos includes 'title' as the photo title, 'content' as the photo description & then tags/keywords)

I've set the page to display 2 images per page just for testing purposes. I'm been working on it for a while now and each time I get the "next/previous" images to work, then something else breaks.

I do not have any viewer urls defined in the section editors.

Here's the page link: "click on NEXT" and it goes to a blank page:
http://www.billdraker.com/cmsAdmin/bird-photography.php

I've also attached the php file. Thanks! Tina
Attachments:

bird-photography.php 7K

Re: [csdesign] Photo Gallery- next/prev links not displaying images

By gkornbluth - September 12, 2011

Hi Tina,

Here’s a recipe from my CMSB Cookbook http://www.thecmsbcookbook.com that might offer some insights. It deals with previous/next page links.

PREVIOUS/NEXT PAGE LINKS ONLY IF DESIRED IMAGES PER PAGE COUNT IS EXCEEDED


IF UPLOAD FIELDS ARE IN SEPARATE RECORDS

I wanted to display previous and next links on a page but only if there were more than a user specified number of image records available.

First I created a text field called thumbnails_per_page in the single record editor that I call common_information, where the client could enter the maximum amount of images to allow per page.

Then, at the top of the viewer page I defined a variable called $maximages, and added a ‘perPage’ to the “list records” call using that variable, like this:

$maximages = ($common_informationRecord['thumbnails_per_page']);
list($portfolio_imagesRecords, $portfolio_imagesMetaData) = getRecords(array(
'Table name' => 'portfolio_images',
'perPage' => $maximages,

));


NOTE: the variable definition has to be outside the list records call and there are no single or double quotes around $maximages in 'perPage' => $maximages, or the variable won’t work.

I also found it necessary to remove the:

'where' => whereRecordNumberInUrl(1),
from the “list records” call that listed the common_information records.

To generate the Prevous/Next links I used this code in the body of the page:

<?php if ($portfolio_imagesMetaData['totalPages'] > 1): ?>

This is Page <?php echo $portfolio_imagesMetaData['page'] ?> of <?php echo $portfolio_imagesMetaData['totalPages'] ?>

<?php if ($portfolio_imagesMetaData['nextPage']): ?>
<br /><a href="<?php echo $portfolio_imagesMetaData['nextPageLink'] ?>">Click Here to See More of My Work.

</a>

<?php endif ?>
<?php if ($portfolio_imagesMetaData['prevPage']): ?>
<br /><a href="<?php echo $portfolio_imagesMetaData['prevPageLink'] ?>">Click Here to See My Previous Portfolio Page.</a>

<?php endif ?>
<?php endif ?>

There’s also some additional information on other implementations in this post: http://www.interactivetools.com/forum/gforum.cgi?post=75239

Hope it solves some issues.

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: [gkornbluth] Photo Gallery- next/prev links not displaying images

By csdesign - September 13, 2011

Thanks Jerry!!

All I had to do was remove the line you suggested and it works perfect! :)

'where' => whereRecordNumberInUrl(1),

Re: [gkornbluth] Photo Gallery- next/prev links not displaying images

By csdesign - September 13, 2011

In addition to that... how would I go about having the "content" (top of page description) to display only on the 1st page - not on every single gallery page (accessed via the prev/next feature)

This page is a combination of two section editors "bird_photography_gallery" is a single record that contains just the title & content (gallery description).

The "bird_photos" editor is the multi-record photo gallery.

this is the script that pulls in the "content" (gallery description) and I want it to appear ONLY on the 1st page of the gallery.

<?php echo $bird_photography_galleryRecord['content'] ?>

page online:
http://www.billdraker.com/cmsAdmin/bird-photography.php

Thanks!!! Tina

Re: [csdesign] Photo Gallery- next/prev links not displaying images

By gkornbluth - September 13, 2011

Hi Tina,

You might play around with wrapping your content in an if statement something like:
<?php echo $bird_photosMetaData['page'] == 1 ?>
<?php echo $bird_photography_galleryRecord['content'] ?>
<?php endif ?>


(if that doesn't work try 0 instead of 1. I'm not sure if the page count starts at 1 or 0)

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: [gkornbluth] Photo Gallery- next/prev links not displaying images

By csdesign - September 13, 2011

Thanks for the reply Jerry!

I tried the code: (tried 0, 1 & even 2)

<?php echo $bird_photosMetaData['page'] == 1 ?>
<?php echo $bird_photography_galleryRecord['content'] ?>
<?php endif ?>

I get this error:
Parse error: syntax error, unexpected T_ENDIF in /home/billd3/public_html/cmsAdmin/bird-photography.php on line 51

<?php endif ?> is line 51

Re: [csdesign] Photo Gallery- next/prev links not displaying images

By gkornbluth - September 13, 2011

Of course you got an error, and it's my fault. I copies the wrong line of code and didn't look closely enough at it.

the first line of code should be an if statement.

something like:

<?php if ($bird_photosMetaData['prevPage'] == 1): ?>

Sorry,

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: [csdesign] Photo Gallery- next/prev links not displaying images

By gkornbluth - September 13, 2011

Glad it worked

Really Nice Looking Site...


Jerry
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: [gkornbluth] Photo Gallery- next/prev links not displaying images

By csdesign - September 13, 2011

Thanks!! Just a few more touches including a slideshow on the homepage so I might be back on the forum for a little help with that but I'm going to try to tackle it on my own. :)

Thanks again - your help is really appreciated :)