display pics in rows

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 25, 2008   (RSS)

By s2smedia - November 25, 2008

I have a photo upload section where i want each photo to show up horizonal instead of vettically...

I need each row to have 3 pics...

after the 3rd pic i need it to repeat a new row

here is my code but it keeps adding the pics to the same row after the 3rd one:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php foreach ($photo_galleryRecords as $record): ?>
<td><?php foreach ($record['image_uploader'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox" title="<?php echo $record['title'] ?>"> <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a></td> <?php endif ?>
<?php endforeach ?>
<?php endforeach; ?>
</tr>
</table>
<br/>




<?php if (!$photo_galleryRecords): ?>
<span class="bodytext">No Photos Available!</span><br/><br/>
<?php endif ?>

Re: [s2smedia] display pics in rows

By Dave - November 25, 2008

Hi s2smedia,

Try this:

<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>

<?php foreach ($photo_galleryRecords as $record): ?>
<?php foreach ($record['image_uploader'] as $upload): ?>

<td><a href="<?php echo $upload['urlPath'] ?>" rel="lightbox"
title="<?php echo $record['title'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>"
alt="" /></a></td>

<?php $maxCols=3; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>

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

</tr></table><br/>


Let me know if that does what you want.
Dave Edis - Senior Developer
interactivetools.com