Display a list of Items in a folder

Description

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

Code

${esc.hash}set (${esc.dollar}foldersList = ${esc.dollar}macro.getfileRepository("/demos/", "true", ${esc.dollar}request))
${esc.hash}set (${esc.dollar}filesList = ${esc.dollar}macro.getfileRepository("/demos/", "false", ${esc.dollar}request))

<h2> Folders </h2>
<ul>
${esc.hash}foreach(${esc.dollar}folder in ${esc.dollar}foldersList)
  <li> ${esc.dollar}folder.title - ${esc.dollar}folder.path </li>
${esc.hash}end
</ul>

<h2> Files </h2>
<ul>
${esc.hash}foreach(${esc.dollar}file in ${esc.dollar}filesList)
  <li> ${esc.dollar}file.title - ${esc.dollar}{file.path}${esc.dollar}{file.fileName} </li>
${esc.hash}end
</ul>​