Help sorting images into columns
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 11, 2008 (RSS)
By _kate_ - November 11, 2008
I've used this code quite a few times, however when trying to use it for the image gallery on a new site I've run into some problems - the images are still displaying one underneath each other and not into columns. I'm sure it's something simple but I just can't figure out what I've done wrong!! Can anyone point me in the right direction? Thanks!
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($galleryRecords as $record): ?>
<span class="heading"><?php echo $record['title'] ?></span><br/>
<td width="200" align="center" valign="top" style="padding-bottom: 16px;">
<?php foreach ($record['photos'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" class="Images" rel="facebox"><img src="<?php echo $upload['urlPath'] ?>" width="100" style="margin: 0 0 10px 20px" /></a><br/>
</td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?>
<?php endforeach; ?>
<?php if (!$galleryRecords): ?>
There are currently no photos. Please check this page again shortly.
<?php endif ?>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($galleryRecords as $record): ?>
<span class="heading"><?php echo $record['title'] ?></span><br/>
<td width="200" align="center" valign="top" style="padding-bottom: 16px;">
<?php foreach ($record['photos'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" class="Images" rel="facebox"><img src="<?php echo $upload['urlPath'] ?>" width="100" style="margin: 0 0 10px 20px" /></a><br/>
</td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?>
<?php endforeach; ?>
<?php if (!$galleryRecords): ?>
There are currently no photos. Please check this page again shortly.
<?php endif ?>
</tr>
</table>
Re: [_kate_] Help sorting images into columns
By Dave - November 11, 2008
Hi kate,
The heading is actually no inside a table cell. The first step would be to create a mockup of what you want it to look like. It usually much easier to get the CMS to output something you already have (that's the process I follow).
I'm not exactly sure what the output should be but try this:
Hope that helps!
The heading is actually no inside a table cell. The first step would be to create a mockup of what you want it to look like. It usually much easier to get the CMS to output something you already have (that's the process I follow).
I'm not exactly sure what the output should be but try this:
<?php foreach ($galleryRecords as $record): ?>
<span class="heading"><?php echo $record['title'] ?></span><br/>
<table border="1" cellpadding="0" cellspacing="0"><tr>
<?php foreach ($record['photos'] as $upload): ?>
<td width="200" align="center" valign="top" style="padding-bottom: 16px;">
<a href="<?php echo $upload['urlPath'] ?>" class="Images" rel="facebox"><img src="<?php echo $upload['urlPath'] ?>" width="100" style="margin: 0 0 10px 20px" /></a><br/>
</td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?>
</tr></table>
<?php endforeach; ?>
<?php if (!$galleryRecords): ?>
There are currently no photos. Please check this page again shortly.
<?php endif ?>
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com