Details page with picture links to other in same category

13 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2013   (RSS)

By Jason - September 17, 2013


I took a look at your code.  What's happening is that you are using $relatedProjects for your foreach loop, which is correct, but you are outputting data from $projectsRecord inside your loop.  This is why you are getting the same record output over and over.  Try changing your foreach loop block like this:

<?php foreach ($relatedProjects  as $record): ?>

  <td width="25%" valign="top" bgcolor="#FFFFFF">
    <div class="project_thumbnail">
      <?php foreach ($record['snapshot'] as $index => $upload): ?> 
  <a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" /></a>
<div style="color:#333333; font:Verdana; font-size: 11px;  text-transform: uppercase"><b><?php echo htmlencode($record['title']) ?></b></font></div>       
      <?php endforeach ?>   
      <?php $maxCols=4; if (@++$count % $maxCols == 0): ?>
<?php endif; ?>
<?php endforeach ?>

Hope this helps

Jason Sauchuk - Project Manager

Hire me! Save time by getting our experts to help with your project.

By thenetgirl - September 17, 2013

Got it thanks Jason