I have a custom js image slider that should echo the number of all slides as well as the number of the current slide (e.g. “Image 4 of 15”). I usually do this with JS, but as PHP-beginner who recently found out about the ->count() option I wanted to ask you if there is a way with PHP to show the number of the current item within this foreach loop?
You can use indexOf() to get the number of the current item in the collection (if you use toStructure() to convert your structure field into a collection, doesn’t work with yaml(), since that returns an array)