Re: [HDLLC] Building table for uploads (photos)....
Hi Jeff,
You're actually very close.
What you have here is an outer loop (looping through your records) and an inner loop (looping through the images for a single record). The problem here is that your <td> tags and your column counting code is in your outer loop. This means that each record will have a single cell with all of their images in it, with a maximum of 4 records (cells) per row.
To have it so you get 4 images per row, regardless of the record they are coming from, you need to move your <td> and column counting code into the inner loop like this:
<table width="133" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<?php foreach ($live_buckeye_deer_camsRecords as $record): ?>
<?php foreach ($record['photos'] as $upload): ?>
<td align="center" valign="top">
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $record['_link'] ?>"> <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" border="0" /></a><br/>
<?php elseif ($upload['isImage']): ?>
<a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" border="0" /></a><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">No Thumbnail Available</a><br/>
<?php endif ?>
</td>
<?php $maxCols=4; if (@++$count % $maxCols == 0): ?>
</tr>
<tr>
<?php endif; ?>
<?php endforeach ?>
<?php endforeach; ?>
</tr>
</table>
Hope this helps get you started
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/