SS includes only when there is picture content

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

By chassa2556 - January 4, 2009 - edited: January 4, 2009

Hi

I have a site where a image grid pulls into the top of the page as a gallery to the body copy below. This goes in the form of a big picture and then three smaller thumbs alongside.

I have a requirement for this image grid only to be pulled in when there are pictures in the CMS and when there aren't for there to be only body copy.

At the moment I've got this

<td> <?php include("image-grid.php") ?> </tr>
<tr>


This seems to be pulling in the grid but is there an 'if' statement for this that would stop the SSI being pulled in if there were no pics added on the back end?

Re: [chassa2556] SS includes only when there is picture content

By Dave - January 6, 2009

Hi chassa2556,

Try this:

<?php if ($record['uploads']): ?>
<?php include("image-grid.php") ?>
<?php else: ?>
sorry no uploads
<?php endif ?>


Except replace $record['uploads'] with the variable name and uploads field used in your viewer code. Eg: could be $galleryRecord['photos'] or something else.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com