Answers.Body: <p>I have created the <a href="https://gum.co/AssetsBroswer" rel="nofollow">Assets Browser Plugin</a> which allows to browse an asset source or a specific folder on the frontend.</p>
  
  <p>Although it is not a treeview it serves me well for outputting a download area on the website. It works even with the <a href="https://github.com/tikiatua/internal-assets-plugin" rel="nofollow">Internal Assets Plugin</a> for a member-only area.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-06T10:43:12.233Z
Answers.LastActivityDate: 2016-01-06T10:43:12.233Z
Answers.UserDisplayName: Lars Bilke
Answers.Body: <p>Yoursort, my answer was based on the assumption that the AssetsService could be used in templates. Ofcourse, only the variables can be used.</p>
  
  <p>I don't have time to dive into this (now), but I think your best bet is to get all images, use <a href="http://buildwithcraft.com/docs/templating/assetfilemodel#folder" rel="nofollow">`asset.folder'</a> for each asset and 'rebuild' the hierarchical list of folder and their assets. Again, use <a href="http://buildwithcraft.com/docs/templating/cache" rel="nofollow">cache</a> ;)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-06T09:51:29.823Z
Answers.LastActivityDate: 2014-10-06T09:51:29.823Z
Answers.UserDisplayName: Paul
Body: <p>I like to display a tree-like view of all files in an asset source:</p>
  
  <ul>
  <li>Folder_X
  <ul>
  <li>File_A</li>
  <li>File_B</li>
  <li>Folder_Y
  <ul>
  <li>File_C</li>
  </ul></li>
  </ul></li>
  <li>Folder_Z
  <ul>
  <li>...</li>
  </ul></li>
  </ul>
  
  <p>I know that I can iterate over all assets in a source (<code>{% for file in craft.assets.sourceId('1') %}</code>) but this gives just an alphabetically sorted list of all files. Maybe we need something like the <a href="http://buildwithcraft.com/docs/templating/nav" rel="nofollow">nav-tag</a>.</p>
  
Tags: <templating><assets><ordering>
Title: How to display a tree view of all assets?
ThreadText: # How to display a tree view of all assets?
  
  (Asked by: username_0 on 2014-10-06)
  
  I like to display a tree-like view of all files in an asset source:
  
  * Folder\_X
    + File\_A
    + File\_B
    + Folder\_Y
      - File\_C
  * Folder\_Z
    + ...
  
  I know that I can iterate over all assets in a source (`{% for file in craft.assets.sourceId('1') %}`) but this gives just an alphabetically sorted list of all files. Maybe we need something like the [nav-tag](http://buildwithcraft.com/docs/templating/nav).
  
  **Tags:** templating, assets, ordering
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-01-06. Score: 1 | Accepted answer
  
  I have created the [Assets Browser Plugin](https://gum.co/AssetsBroswer) which allows to browse an asset source or a specific folder on the frontend.
  
  Although it is not a treeview it serves me well for outputting a download area on the website. It works even with the [Internal Assets Plugin](https://github.com/tikiatua/internal-assets-plugin) for a member-only area.
  
  
  ---
  
  ### Answer by username_1 on 2014-10-06. Score: 1
  
  Yoursort, my answer was based on the assumption that the AssetsService could be used in templates. Ofcourse, only the variables can be used.
  
  I don't have time to dive into this (now), but I think your best bet is to get all images, use [`asset.folder'](http://buildwithcraft.com/docs/templating/assetfilemodel#folder) for each asset and 'rebuild' the hierarchical list of folder and their assets. Again, use [cache](http://buildwithcraft.com/docs/templating/cache) ;)
  
  
  ---
  
  