How can I list only documents - and NO images - in their folder on the front end?
_I am able to show all folders and their files (documents and images) on the front end. My difficulty is to filter the files to get only documents and not the images.
I searched the entire internet and tried every suggestion I could find. I guess I have overlooked something and the solution is really easy and elegant…
Something like this e.g. doesn’t work:
in template:
<% if $ClassName != "SilverStripe\Assets\Image" %>
I’m surprised that doesn’t work. Maybe try printing out $ClassName in your loop and see what you’re getting? Here are some other things to try:
<% if $ClassName != "Image" %>
<% if $ClassName.ShortName != "Image" %>
<% if not $IsImage %>
<% if not $Width %>
You’d probably be better off filtering the list though so you’re only looping over non Images. Something like <% loop $Files.exclude('ClassName', 'SilverStripe\Assets\Image') %> although if that doesn’t work within a loop it might not work to filter the list either.
Thank you so much, JonoM!
I am one step closer, as it worked except for the first folder found.
I tried all of the above and even one I forgot to mention earlier (<% loop $Children.filter(‘ClassName:not’, ‘SilverStripe\Assets\Image’) %> which I think I found somewhere in the docus , but only the <% loop $Files.exclude('ClassName', 'SilverStripe\Assets\Image') worked, but I needed the Children version of it: