Display a list of Items in a folder


This snippet shows how to the use the macro viewtool's fileRepository method to build a list of files and folders in a folder.  This is the same viewtool that the fileRepository macro uses.  You have to get the folders and files separately. 

The objects in the lists are:

Folder Objects - http://dotcms.org/api/com/dotmarketing/portlets/folders/model/Folder.html
File Objects - http://dotcms.org/api/com/dotmarketing/portlets/files/model/File.html


#set ($foldersList = $macro.getfileRepository("/demos/", "true", $request))
#set ($filesList = $macro.getfileRepository("/demos/", "false", $request))

<h2> Folders </h2>
#foreach($folder in $foldersList)
  <li> $folder.title - $folder.path </li>

<h2> Files </h2>
#foreach($file in $filesList)
  <li> $file.title - ${file.path}${file.fileName} </li>