Hey all, I’m hoping someone can help me here. I am using MIGX TVs to add content sections to a webpage. Where more than one image is added I am populating a carousel, and where there is a single image I am just displaying that image. I am wanting to use the Modx IF plugin to output different chunks but I am having some difficulty figuring out how to just get the image count.
[[+Images]] outputs is array rather than an integer, so it isn’t working in the line subject='[[+images]]' . Is there a quick way to get the image count from the nested Images TV to use here? I have tried using [[+total]] instead, but it gives me an unexpected value.
You are correct, [[+images]] does return a JSON string. Your suggestion didn’t work as it was, but after a bit of tinkering I managed to get there. Here is my result:
With a construct like yours, this could result in parsing issues, when you have large results and both getImageList calls will allways be parsed here.
Also, there is no reason to call If uncached here.
If you go this route with the custom snippet, why not put all the logic into your snippet and run getImageList with $modx->runSnippet inside GetImageCount