if statement problem

2 posts by 1 authors in: Forums > CMS Builder
Last Post: May 16, 2011   (RSS)

By buttermilk - May 16, 2011

Hello all,

I'm hoping somebody can help me with this.

I've got a list page view that shows all records in a section editor ("inventory"). In that section editor I have a check box as a data field so that only the first record displays the "content" text on this list page. I included a little "if statement" that seems to work. So far so good.

What I'd like to do is have the images on that particular record remain hidden (or undisplayed, if that's even a word) too. For the life of me I cannot achieve this.

Here's my code:
<table border="0" cellpadding="3" cellspacing="3" style="font-size:9px;">
<tr>
<?php foreach ($inventoryRecords as $record): ?>

<?php if ($record['main_blurb']): ?>
<?php echo $record['content'] ?>
<?php endif ?>

<?php foreach ($record['images'] as $upload): ?>
<td width="170" valign="bottom"><?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<div class="big_links"><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></div></td>
<?php endif ?>
<?php break ?>
<?php endforeach ?>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?>
</tr>
<tr>
<?php endif; ?>
<?php endforeach ?>
</tr>
</table>
<?php if (!$inventoryRecords): ?>
No records were found!<br/>
<br/>
<?php endif ?>