Hi,
I've set-up and have a loop that displays modular content on a page. All good up to here.
But I wanted to enhance the user experience by showing a "nothing available" should there be no modular content for this loop.
And some how I feel like I'm missing something but it's not working.
As you can see in my code, I added a vardump() to make sure the count is correct. And it is.
On a page where there is no modular content, it dumps int(0). And when there are, the it dumps the correct count.
But the following condition does not work. Does anybody know what am I not doing correctly ??
Here is my code.
TWIG{% set totalmodule = page.collection.modular|length %} <h2>{{ vardump(totalmodule)}}</h2> {% for module in page.collection() if module.template == 'modular/suite' %} {% if totalmodule >= 1 %} {{ module.content }} {% else %} <h2>No suites available for this property</h2> {% endif %} {% endfor %}