Only show first image in listing
3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 20, 2009 (RSS)
By (Deleted User) - August 18, 2009
How,
I want to show only the first image in the listing. I want to show all iamges in the detail page.
Please check this example:
http://www.superiorlighting-nyc.com/fluorescent/wet_location.php
As you can see, item SVT has two images. I want to show only the first image. How can it be done?
I want to show only the first image in the listing. I want to show all iamges in the detail page.
Please check this example:
http://www.superiorlighting-nyc.com/fluorescent/wet_location.php
As you can see, item SVT has two images. I want to show only the first image. How can it be done?
Re: [RapidWeb] Only show first image in listing
By Chris - August 18, 2009 - edited: August 18, 2009
Hi RapidWeb,
You probably have a section like this in your list page:
The easiest way to change this so it displays only the first upload is to add a "break" statement just before the endforeach:
Hope this helps! Please let us know if you have any more questions.
You probably have a section like this in your list page:
<!-- STEP 2a: Display Uploads for field 'upload' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, ..., info1, info2, info3, info4, info5 -->
<?php foreach ($record['upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt='' /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt='' /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
The easiest way to change this so it displays only the first upload is to add a "break" statement just before the endforeach:
...
<?php endif ?>
<?php break; ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
Hope this helps! Please let us know if you have any more questions.
All the best,
Chris
Chris
Re: [chris] Only show first image in listing
By (Deleted User) - August 20, 2009
Chris,
Thanks! Works wonders! What I love about Interactive Tools is that you don't need to be a programmer. Just follow the simple instructions. And when you do run into a small stag, the staff is here to help.
Thanks! Works wonders! What I love about Interactive Tools is that you don't need to be a programmer. Just follow the simple instructions. And when you do run into a small stag, the staff is here to help.