Hello, All -
I'm sure we must have covered this before - but here we go anyway...
On a List page, how do I limit the number of (image) uploads displayed with each record?
I've just created a Gallery category which features multiple sections spread over many pages. Each page includes a Title, some Content text and about 24 uploaded images.
The galleryList.php is the index from which visitors can access each gallery page. Alongside each link I would like to display a single random thumbnail image (from the corresponding section).
The basic code would be something like this...
<?php
require_once "/xyz/viewer_functions.php";
list($galleryRecords, $galleryMetaData) = getRecords(array(
'tableName' => 'gallery',
));
?>
<?php foreach ($galleryRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a>
<?php foreach ($record['gallery_images'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php endif ?>
<?php endforeach ?>
<?php endforeach; ?>
It seems simple enough but I can't remember how to limit the number of thumbnails. Instead of a single image I get one of every picture in each gallery! The only way I've been able to control this is by inserting a <?php break; ?>[/#ff0000] - but this seems rather clumsy!
Surely there must be a more elegant way of controlling which and how many thumbnails are displayed?
:0)
Perch