Hi,
I've created two snippets to show different content depending on how many images are in a MIGX table on a page. It works fine if there are one or more images, but if there are zero images it displays the same content as if there was one.
Snippet #1 (for 1 image):
<?php
$items = $modx->fromJSON($input);
if(count($items) == 1){
$output = 'Output this if there is 1 image';
};
return $output;
Snippet #2 (for 2 or more images):
<?php
$items = $modx->fromJSON($input);
if(count($items) > 1){
$output = 'Output this if there is 2 or more images';
};
return $output;
So, snippet #2 works as expected, the content is only shown of there are two or more images.
The content in snippet #1 on the other hand is shown even if there are 0 images, and I only want to to show if there is exactly one image.
Any ideas of what I'm doing wrong?
[ed. note: sketchi last edited this post 9 years, 7 months ago.]