0

I'm doing some local dev with Assets 2.1.2 and trying to get it to output a folders and file structure.

However, I can get the folders to display but no files. Even the tags that are meant to output the count of files/folders don't show there are files there.

The files display perfectly well within Assets in the Control Panel

This is the code I'm using to test.

<ul>
{exp:assets:folders}
    <li>{folder_name}</a>
        <p>Total subfolders: {total_subfolders}</p>
        {if total_subfolders}
            <ul>
                {subfolders}
            </ul>
        {/if}
        <ul>
            {exp:assets:files}
                    <li>
                        <p>Total files: {total_files}<br>
                        <a href="{url}">{if title != ""}{title}{if:else}{filename}{/if} ({size})</a></li>
                        {if no_results}<p>No files</p>{/if}
            {/exp:assets:files}
        </ul>
    </li>
{/exp:assets:folders}
</ul>

The resulting output looks like this

Content images
Total subfolders: 0

Member files
Total subfolders: 0

News images
Total subfolders: 0

Provider Logos
Total subfolders: 0

Projects
Total subfolders: 11

    Committee
    Total subfolders: 10

        Meetings
        Total subfolders: 4

            2012-12-05 Berlin
            Total subfolders: 1

                Presentations
                Total subfolders: 0

            2013-01-28 Paris
            Total subfolders: 0

            2013-04-21 London
            Total subfolders: 0

       Project Groups
       Total subfolders: 4

           PG1
           Total subfolders: 0

           PG2
           Total subfolders: 0

           PG3
           Total subfolders: 0

           PG4
           Total subfolders: 0

Slider images
Total subfolders: 0

There are a number of files in the 2012-12-05 Berlin directory (as well as the top level directories) that just don't show up.

Furthermore adding the folder_id, parent_folder or folder parameters doesn't have any effect on what is output. The list always starts from the top most directory.

I've tried setting it to output from {filedir_6} (which is the Projects directory) but the output is just as above.

So... but in Assets 2.1.2 or am I missing something?

  • Are your file paths relative or err....the other kind? – JohnWBaxter May 7 '13 at 15:46
  • Hey foamcow - I have a few bug reports in around this not working. I think that you may be running into those. I'll keep you updated on that progress. – Lisa May 7 '13 at 15:52
  • John, the paths are in the form '/path/from/server/root/to/directory' – foamcow May 7 '13 at 16:14
  • I am having exactly the same issue. Any updates? – Niall Thompson May 9 '13 at 0:05
0

sorry for the long wait - we've isolated the bug and fixed it - the fix will be included in the next release.

For a hot-fix, open the third_party/assets/libraries/assets_lib file, locate the get_files_in_folder method and add this at the very beginning of this method:

if (is_array($file_ids))
{
  $file_ids = array_filter($file_ids);
}

That should fix your thing!

| improve this answer | |
  • I tried the patch and it seemed to sort of work. Now I've updated to the new version 2.1.3 and I'm finding that files are displayed but I cannot get the parent_folder parameter to work. It just seems to be ignored. – foamcow May 11 '13 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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