Making images show up in Columns

2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 2, 2010   (RSS)

Re: [dccreatives] Making images show up in Columns

By Jason - December 2, 2010

Hi,

You're quite close. Since $itemsRecord is only 1 record, we don't need a foreach loop for it, so that can be removed. We just need to re-arrange the other code to fit inside our 1 foreach loop that we use for outputting the images.

Try this:

<table width="700" align="center" cellpadding="2" cellspacing="2" border="5">
<tr>
<?php $maxCols=3;?>
<?php foreach ($itemsRecord['lamping_image'] as $upload): ?>
<td width="233" align="left">
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[dia]" alt="" title=""><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>

</td>
<? if (@++$count % $maxCols == 0): ?></tr><tr><?php endif ?>
<?php endforeach ?>
</tr>
</table>


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/