Random Placement from Single Editor

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 18, 2011   (RSS)

I've created a single Editor specifically for a 'photo bank' for the client. Originally I had it as a multi editor, but the client would have to upload the images one at a time... the single editor is much easier to upload since the can upload several.

I know how to get the header code to display records randomly with the multi section editor.. but not for the single.

here's my viewer code:
list($interior_page_photosRecords, $interior_page_photosMetaData) = getRecords(array(
'tableName' => 'interior_page_photos',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$interior_page_photosRecord = @$interior_page_photosRecords[0]; // get first record


and here's the body code:
<?php foreach ($interior_page_photosRecord['photos'] as $upload): ?>
<p><img src="<?php echo $upload['thumbUrlPath'] ?>" class="image-border" /></p>
<p><?php echo $upload['info1'] ?></p>
<?php break; ?>
<?php endforeach ?>


I inserted the break to display only one image at a time.. just need to insert the random action
John Tedesco

Creative Director



JAM Graphics

Re: [Dave] Random Placement from Single Editor

By rconring - August 18, 2011

Hey Dave ... Thanks for that! I have been trying to figure out how to display a random photo from a "featured" article's photo gallery on the home page. This did exactly what I wanted!
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987