I have the following twig code:
{% for likeditem in user.getItemLikes() %} //iterate over each liked items here {% endfor %}
however, I wanted to repeat only the first 3 elements of user.getItemLikes()
user.getItemLikes()
how to do it?
It looks like you can use the slice filter for what you are trying to do:
{% for likeditem in user.getItemLikes()|slice(0,3) %} //iterate over each liked items here {% endfor %}
Source: https://habr.com/ru/post/1482776/More articles:Tkinter inserts Combobox inside Treeview widget - python-3.xmonogame content load file no exception found - androidBootstrap and Youtube mods: auto play and stop when closing - jqueryInaccuracy when using modulo in Lua - floating-pointSuper agent coding issue - javascriptContentLoadException in MonoGame - c #How to debug Node.js / JavaScript code created using CoffeeScript? - javascriptAzure SQL Server CE Initialization string format does not meet specification starting with index 0 - c #I keep getting "Not Found. Passthru Authentication" to log into Facebook to connect using Devise - Need to debug - ruby-on-railsSorting gives inconsistent results due to loop binding - cAll Articles