2

I'm totally confused about Assets. I'm just trying to show the contents of a folder in a template. Here's my folder structure (dashes indicate subfolders):

Docs
-staff
--board
-public
Images
Logos

How would I display the contents of, say, the "public" folder? For some reason I'm not getting it.

Thanks for any help.

1 Answer 1

2

You're after the exp:assets:files template tag:

{exp:assets:files folder="{filedir_1}public"}
            <li>File name: {filename}</li>
{/exp:assets:files}

Change {filedir_1} to whatever is appropriate for your Assets field.

To find what your filedir id is, go to Content → Files → File Upload Preferences and hover your mouse cursor over the appropriate "Edit" icon for the directory.

Within your browsers status bar, you will see "id=X". Use this number within {filedir_X}, for example in my screenshot mine is {filedir_1}.

Find File Directory ID

Note: It's not clear in your answer, but if your "Server Path to Upload Directory" is set to something like /home/me/www/assets/docs" and you've created the "public" directory within Assets. Then your correct folder path to 'public' is: folder="{filedir_1}public"

6
  • Oh, so I don't have to wrap it in the exp:assets:folder tag?
    – Mike Mella
    Jan 31, 2014 at 14:08
  • Also, how would I determine the correct filedir?
    – Mike Mella
    Jan 31, 2014 at 15:11
  • @MikeMella No, this works without the folder tag. And I've updated my answer on how to find your filedir ID.
    – Michael P
    Jan 31, 2014 at 23:30
  • Hmm, still no-go. I can make it work using folder_id=, but not folder=. My path is /home/me/public_html/images/uploads/docs/ and the other dirs are made in Assets. Status bar shows me that it's filedir_1. Even this shows nothing (this folder does contain files): {exp:assets:files folder="{filedir_1}"}.
    – Mike Mella
    Feb 3, 2014 at 16:44
  • Hmm, this is definitely working for me using Assets 2.2.2/EE 2.7.3. Take a look at my working example screenshot and double check everything on your end.
    – Michael P
    Feb 3, 2014 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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