working on a site that needs to read a lot of data gathered from minecraft servers and Im using the labels 'status' and 'query' to show how each server was found. since not all servers were found with query there isnt a player list or plugin list and that was easy to set up but now im having issues setting up an if statement to find if a plugin/player list is empty to cut down on the amount of elements needed but no matter what i do it always displays the button elements. as you can see when i show the output of item.playerlist or item.plugins it shows [] which is why ive tried checking if its not equal to that and i also tried checking if the list is none but that hasnt worked either. code output
Asked
Active
Viewed 303 times
1 Answers
0
If I understood correctly you need to make a if statement to check the length of an array in jinja ? Using this answer you can make something like this :
{% if my_array|length > 0 %}
<!-- code here --!>
{% endif %}
I hope it will help you !

Antoine Piron
- 31
- 1
- 7