Multi Record show 1 image

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

Re: [s2smedia] Multi Record show 1 image

By Dave - February 9, 2009

Hi s2smedia,

Try this:

<?php foreach ($eventsRecords as $record): ?>

<?php shuffle($record['image']); ?>
<?php foreach ($record['image'] as $upload): ?>

<img src="<?php echo $upload['urlPath'] ?>"
width="<?php echo $upload['width'] ?>"
height="<?php echo $upload['height'] ?>"
alt="" /><br/>
<?php break; ?>
<?php endforeach ?>

<?php endforeach; ?>


Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi Record show 1 image

Its still showing all 3 images.

Re: [s2smedia] Multi Record show 1 image

By Dave - February 10, 2009

Try this:

<?php shuffle($eventsRecords); ?>
<?php foreach ($eventsRecords as $record): ?>

<?php shuffle($record['image']); ?>
<?php foreach ($record['image'] as $upload): ?>

<img src="<?php echo $upload['urlPath'] ?>"
width="<?php echo $upload['width'] ?>"
height="<?php echo $upload['height'] ?>"
alt="" /><br/>
<?php break; ?>
<?php endforeach ?>

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


That will show one random image from one random record in the list.

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

Re: [Dave] Multi Record show 1 image

That does it!! thanks