
kcmedia
User
Dec 9, 2011, 4:27 PM
Post #4 of 10
(935 views)
Shortcut
|
Hi Jason i sort of got it working but the issue is that it is displaying all the images it should only show the first image of each bike in the list I have attached the code again and also the cmsb code. <?php /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */ // load records list($custom_motorbikesRecords, $custom_motorbikesMetaData) = getRecords(array( 'tableName' => 'custom_motorbikes', )); ?> <!-- STEP2: Display Records (Paste this where you want your records to be listed) --> <h1>Custom Motorbikes - List Page Viewer</h1> <?php foreach ($custom_motorbikesRecords as $record): ?> Record Number: <?php echo $record['num'] ?><br/> Title: <?php echo $record['title'] ?><br/> Features: <?php echo $record['content'] ?><br/> Text: <?php echo $record['text'] ?><br/> _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/> <!-- STEP 2a: Display Uploads for field 'logo' (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['logo'] 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 --> <!-- STEP 2a: Display Uploads for field 'upload' (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['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 --> <hr/> <?php endforeach ?> <?php if (!$custom_motorbikesRecords): ?> No records were found!<br/><br/> <?php endif ?> <!-- /STEP2: Display Records --> Thanks Craig KC Media Solutions www.kcmedia.biz
|