Multi-record displaying in Multiple Columns - help please! :)
3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 17, 2013 (RSS)
By csdesign - April 17, 2013
I've done this before and tried using the same code but it wouldn't work for me. I pulled code from the cmscookbook and that's not flying either so I'm assuming it's something obvious that I'm doing wrong. Here's my code:
Thanks!!! Tina
<?php foreach ($wildlife_photographyRecords as $record): ?> <table width="470" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="295" align="center" valign="middle"> <?php foreach ($record['images'] as $index => $upload): ?> <table width="100" border="0" cellpadding="4" cellspacing="0" id="frame"> <tr> <td align="center" valign="middle"><a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $upload['info1'] ?>" /></a></td> </tr> </table> <?php break /* only show one image */ ?> <?php endforeach ?> </td> <td width="236" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td bgcolor="#20232B"><h3><a href="<?php echo $record['_link'] ?>"><?php echo htmlencode($record['title']) ?></a></h3></td> </tr> <tr> <td bgcolor="#20232B" class="content"><?php echo htmlencode($record['short_image_description']) ?></td> </tr> <tr> <td bgcolor="#20232B" class="bannerCaption">LOCATION:</span><span class="content"> <?php echo htmlencode($record['location']) ?></td> </tr> <tr> <td bgcolor="#20232B"><?php echo htmlencode($record['paypal_add_to_cart_code']) ?></td> </tr> <tr> <td bgcolor="#20232B"><h5><?php echo htmlencode($record['image_tags']) ?></h5></td> </tr> </table></td> </tr> <tr> <td align="center" valign="middle"> </td> <td align="center" valign="middle"> </td> </tr> </table> <?php $maxCols=2; if (@++$count % $maxCols == 0): ?><?php endif; ?> <?php endforeach ?>
By csdesign - April 17, 2013
Oops. Forgot... The records are displaying in a single column rather than 2 columns.
http://www.greatbearreflection.com/wildlife-big-game-photography-wy.php
By gkornbluth - April 17, 2013 - edited: April 17, 2013
Hi Tina,
Here's the basic code for a 2 column image layout based on the recipe LIMITING THE AMOUNT OF COLUMNS IN A MULTI ROW IMAGE DISPLAY in the CMSB Cookbook http://www.thecmsbcookbook.com :
<table >
<tr>
<td >
<tr>
<?php foreach ($wildlife_photographyRecords as $record): ?><?php foreach ($record['image'] as $upload): ?>
<td>
<table>
<tr>
<td ><a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php
echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" style="border:hidden" /></a>
</td>
</tr>
<tr>
<td ><span class="text_font"><?php echo $record['title'] ?></span>
</td></tr></table>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?> <?php endforeach ?>
</tr>
</table>
Try that and see what you get, and then add in the other fields and the styling that you're using.
Best,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php