Need help connecting CMS to gallery script

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 30, 2013   (RSS)

Hi Meg,

Would it be possible to post all of your code so far? Are you using a custom built slideshow system, or are you using a plugin?

I think something like this might work:

<?php foreach ($detailRecord['images'] as $index => $upload): ?>
<!-- This contains the hidden content for inline calls -->
<div style='display:none'>
  <div id='<?php echo htmlencode($upload['info1']) ?>' style="background:#fff; height: 615px;padding: 20px; -moz-border-radius: 50px;border-radius: 50px;">
    <p align="center">
      <img src="<?php echo $upload['urlPath'] ?>" width="692" height="600" alt="" />
    </p>
    <!--Start prev and next arrows -->
    <div class="arrow-nav2">
      <!--Start arrow left -->
      <div class="arrow-l">
        <?php if($prev = @$detailRecord['images'][$index-1]): ?>
        <a href="<?php echo $prev['info1']; ?>" class="prev"> 
          <img src="images/left-arrow.jpg" width="15" height="15" alt="prev" align="right" border="0"/>
        </a>
        <?php endif; ?>
      </div>
      <!--Start arrow right -->
      <div class="arrow-r">
        <span class="hborder" style="font-size: 15px;">|<a href="#" class="test2">next</a>|
          <?php if($next = @$detailRecord['images'][$index+1]): ?>
          <a href="<?php echo $next['info1']; ?>" class="test2">
            <img src="images/right-arrow1.jpg" width="15" height="15" alt="." align="right" border="0"/>
          </a>
          <?php endif; ?>
        </span>
      </div>
    </div>
  </div>
</div> 
<?php endforeach ?>

This is just example code, so you'll have to make a few changes to get it working with your current system. 

So I've used the $index key to get the previous and next record in the current image array if they exist. If they do then the page displays the info1 field in the links href tag.

Let me know if you have any questions.

Cheers

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By meg - April 30, 2013

Actually, this worked great - thank you! (It's a custom gallery script, FYI)