Showing selective images

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 25, 2014   (RSS)

By JeffC - November 4, 2014

Please can someone advise me how to show selected images

So instead of the code below which shows all uploads I would like to skip uploads 1 and 2 and begin with upload 3:

<?php if ($page['photos']): ?>

<?php foreach ($page['photos'] as $upload): ?>

<div class="thumbnail">
<img src="<?php echo $upload['thumbUrlPath2'] ?>" width="100%" title="<?php echo htmlspecialchars($upload['info1']) ?>" alt="<?php echo htmlspecialchars($upload['info3']) ?>" /><?php if ($upload['info1']): ?>

<div class="caption"><?php echo htmlspecialchars($upload['info2']) ?></div>
<?php endif ?>

thanks

Jeff

By JeffC - November 25, 2014

Hi Ron

Thank you for your idea. It didn't quite work out for me but it got me on the right track. For anyone else that may be looking for a solution here's what i did:

<?php if ($page['photos']): ?>
<?php $uploadCount = 0; ?>
<?php foreach ($page['photos'] as $upload): ?>
<?php if (++$uploadCount < 3) { continue; } ?>
        
<div class="thumbnail">
<!-- Image display code -->
</div>
                
<?php endforeach ?>
<?php endif ?>

Jeff