Quantcast
Viewing all articles
Browse latest Browse all 294917

Views Counter variable only equal to zero with Twig

I created a view. I added the global counter variable field. On a field below the counter field I chose to rewrite the output. In this rewritten field, if I output the counter field using {{ counter }} I get the value I would expect. That is, I get an incremental number starting at 1 for each row in the view. When I try to use Twig in the rewrite field though to test if the counter value is greater than a certain number, like {% if counter > 1 %} for example, it does not work. After several testing, it appears that the counter is always equal to zero when testing it in a Twig if statement, even though it outputs an incremental number each time.


Viewing all articles
Browse latest Browse all 294917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>