Count No of images and act on it

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 28, 2015   (RSS)

By zaba - October 27, 2015

Hi,

I want to  count the number of images in

($aboutRecord['images'])

and if the number of images is <=1, then do something.

I can't figure out how to count the number of images

By Damon - October 28, 2015

Hi zaba,

Try this code:

<?php $imagesTotal = count($aboutRecord['images']); ?>

<?php if($imagesTotal <= 1) : ?>
    There is one or less images.
<?php endif; ?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/