Reverse foreach order

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 10, 2009   (RSS)

By bruno - February 10, 2009

I've got lightbox running on my page that links to the image gallery from a thumbnail. For some reason they lightbox image are loading in reverse order. The caption says 3 of 3 when it should say 1 of 3. I was wondering if there is a way to reverse the foreach order.


<?php

require_once "/Documents/design/Brunello-Redesign/dev/cmsAdmin/lib/viewer_functions.php";

list($web_portfolioRecords, $web_portfolioMetaData) = getRecords(array(
'tableName' => 'web_portfolio',
));

?>


<?php foreach ($web_portfolioRecords as $record): ?>
<div class="grid_4">



<!-- begin lightbox link -->
<?php
foreach ($record['main_images'] as $upload): ?>
<?php if ($upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[web1<?php echo $record['title'] ?>]" title="Record title: <?php echo $record['title'] ?>" >
<?php endif ?>
<?php endforeach ?>



<!-- Begin Thumbnail Image -->
<?php
foreach ($record['thumbnail'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" class="portfolioImg" /></a><!-- end lightbox link -->
<?php endforeach ?><!-- end thumbmail for each -->




<!-- links for lightbox -->
<?php
foreach ($record['main_images'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[web2<?php echo $record['title'] ?>]" title="Record title: <?php echo $record['title'] ?>" ></a>
<?php endforeach ?>
<!-- end links for lightbox -->






<h3><?php echo $record['title'] ?></h3>

<?php echo $record['project_description'] ?>

<!-- begin view more link -->

<p>
<?php
foreach ($record['main_images'] as $upload): ?>
<?php if ($upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[web3<?php echo $record['title'] ?>]" title="Record title: <?php echo $record['title'] ?>" >
<?php endif ?>
<?php endforeach ?>View More &raquo;</a></p>


<!-- end view more link -->


Thanks!

Niki