Hopefully very simple display question

13 posts by 5 authors in: Forums > CMS Builder
Last Post: January 30, 2010   (RSS)

I cannot seem to figure out why i'm getting an unexpected T_ENDFOREACH ..... line 100

Maybe something else on the page. If I take out the "maxcols" statement then it will work but I need the columns

http://www.capstanag.com/cms/agchem_full.php?AIM-Command-1

<table>
<tr>
<?php foreach ($acproductsRecord['gallery'] as $upload): ?>
<td>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox" title="<?php echo $upload['info2'] ?>" ><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo $upload['info1'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a>
</td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>
<?php endforeach ?>
</tr>
</table>

Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] Hopefully very simple display question

By Dave - January 30, 2010

Hi Michael,

You have two ifs but only one endif. You're missing an endif.

Try this (slightly re-organized) code:
<table>
<tr>
<?php foreach ($acproductsRecord['gallery'] as $upload): ?>
<?php if (!$upload['hasThumbnail']) { continue; } ?>
<td><a href="<?php echo $upload['urlPath'] ?>" rel="lightbox" title="<?php echo $upload['info2'] ?>" ><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo $upload['info1'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a></td>

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

<?php endforeach ?>
</tr>
</table>

Dave Edis - Senior Developer
interactivetools.com