only one image

2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 19, 2011   (RSS)

Re: [Maurice] only one image

By Jason - January 19, 2011

Hi Maurice,

You can use a normal foreach loop that you break out of after displaying the first image with a thumbnail.

For example:

<?php foreach($record['images'] as $upload): ?>
<?php if($upload['hasThumbnail']):?>



<?php break; ?>
<?php endif ?>
<?php endforeach ?>


This code will loop through the uploads for that record until it finds and image with a thumbnail. After it outputs the thumbnail, it breaks out of the loop.

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/