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 -
File Objects -


#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>