Identify first upload in multiple upload field

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 9, 2009   (RSS)

Re: [bruno] Identify first upload in multiple upload field

By Dave - February 9, 2009

Hi Bruno,

There's a few ways to do that. You can use break; to stop after just one loop:

<?php foreach ($record['main_image'] as $upload): ?>
... show image ...
<?php break; ?>
<?php endforeach ?>


Or you can load just the first image like this:

<?php $upload = @$record['main_image'][0]; ?>
<?php if ($upload): ?>
... show image ...
<?php endif ?>


You can add brackets and a number on the end to select an image from the list (starting the count from zero).

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [bruno] Identify first upload in multiple upload field

By bruno - February 9, 2009

Hey Dave,

That seems to work but now I have another CMS Builder/lightbox related problem. I will start a new thread for this.


Thanks!

Niki