using Info Field

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 13, 2012   (RSS)

By KCMedia - March 12, 2012

Hi

i have this list of images in a gallery and i have info3 field setup so that is you put a Y into there is should only show that image and break after that image, i cant get it to work can someone help me please, what i want to happen is if there is a Y then it will display that image only regardless of where it is in the list of images.

here is the code

<div id="page_left" class="grid_4">
<h1><?php echo $used_motorcyclesRecord['title'] ?></h1>
<?php echo $used_motorcyclesRecord['content'] ?>
<?php foreach ($used_motorcyclesRecord['images'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<?php if ($upload['info3'] == "Y"): ?><img src="<?php echo $upload['thumbUrlPath3'] ?>" alt="" /><?php endif ?><?php break; ?>
<?php endif ?>
<?php endforeach ?>
<p>&nbsp;</p>

<ul id="thumb_list" class="list_1 clearfix">
<?php foreach ($used_motorcyclesRecord['images'] as $upload): ?>
<li>
<a class="img" href="<?php echo $upload['urlPath'] ?>" rel="shadowbox[a]" title="<?php echo $upload['info1'] ?>">
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" /><span class="icon">+</span>
<?php else: ?>[- no thumbnail -]
<?php endif ?>
</a>
</li>
<?php endforeach ?>
<?php if (!$used_motorcyclesRecord): ?>
No record found!<br/><br/>
<?php endif ?>
</ul>
</div>

Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] using Info Field

By Jason - March 13, 2012

Hi,

Try putting your break statement inside your if statement like this:

<?php foreach ($used_motorcyclesRecord['images'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<?php if ($upload['info3'] == "Y"): ?>
<img src="<?php echo $upload['thumbUrlPath3'] ?>" alt="" />
<?php break; ?>
<?php endif ?>

<?php endif ?>
<?php endforeach ?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/