Image on listing page

4 posts by 2 authors in: Forums > CMS Builder
Last Post: January 28, 2009   (RSS)

On this listings page all the images are showing. I read through the posts and tried several of the suggestions. Then I end up getting only one image, but the one image is for the entire listings page. So the first listing will now have one image and the listings following have no images.

How can I get the listings page to show only one image for each of the listings?

Thanks

Re: [Dave] Image on listing page

HI Dave,

That is one of the suggestions that I found in the forum and tried. I did try that again in case I had it in the wrong place. And you are correct that it stops the loop after one image. Then I get NO image for the second, third, etc. listings. I get only the one image on the first listing only. The rest of the listings list all the info but no images. When I remove the <?php break; ?> that I just added then I am back to showing all the images for all the listings. What I would like is this. If I have 5 listings and each has 5 pictures I want the 5 listings to show on the listings page but I want only the first image of each listing to show. I only need to show all the images on the listingDetail page. Your answer seems to indicate that the loop for the images is nested inside the loop for the listing. That is not the way it appears the code is generated. It has a step2 display records which has an endforeach and then a step2a display uploads. Both seem to be independent loops and not nested. So can you help me out a little more. My code is displayed below:

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Listings - List Page Viewer</h1>
<?php foreach ($realty_listingRecords as $record): ?>
Record Number:
<?php echo $record['num'] ?>
<br/>
Featured Property:
<?php echo $record['featured'] ?>
<br/>
Property Type:
<?php echo $record['property_type'] ?>
<br/>
Price:
<?php echo $record['price'] ?>
<br/>
MLS #:
<?php echo $record['mls'] ?>
<br/>
Address:
<?php echo $record['address'] ?>
<br/>
City:
<?php echo $record['city'] ?>
<br/>
State / Province:
<?php echo $record['state'] ?>
<br/>
Summary:
<?php echo $record['summary'] ?>
<br/>
Description:
<?php echo $record['description'] ?>
<br/>
<br>
View Listing : <a href="<?php echo $record['_link'] ?>">
<?php echo $record['_link'] ?>
</a><br/>
<hr/>
<?php endforeach; ?>
<?php if (!$realty_listingRecords): ?>
No records were found!<br/>
<br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
</td>
<td>
<!-- STEP 2a: Display Uploads for field 'uploads' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['uploads'] 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 break; ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->

Re: [vyskocil] Image on listing page

By Dave - January 28, 2009

Hi vyskocil,

No problem, copy and paste "Step 2a" just above this code:

<?php endforeach; ?>
<?php if (!$realty_listingRecords): ?>

Then it should work properly. Alternatively you can try creating a new list viewer code with the code generator. The code must have gotten shuffled around some how.

If that doesn't work for you let me know and we can take a closer look.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com