Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the case that I have an asset folder structure like this:

/images
   /group-a
   /group-b
   /group-c

How would I loop through all of the images in /group-b without having to assign them to entries.

share|improve this question
up vote 4 down vote accepted

You could use the folderId-parameter in craft.assets:

{% for image in craft.assets.folderId(1) %}
    <li><img src="{{ image.getUrl('thumb') }}" alt="{{ image.title }}"></li>
{% endfor %}

You can get the folderId by inspecting the folder-name in the CP.

share|improve this answer
1  
Is there also a possibility to this recursively? Getting all files from the subfolder and its subfolders. – Lars Bilke May 20 at 19:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.