@BRT.Files()

Creates a list of all files in a system folder.

The @BRT.Files() Helper can be used to create a list of files in a directory, or to access file properties for files in a directory.  It requires the 'directory:' parameter to name the folder tree of the folder whose content will be displayed.
If the optional 'template:' parameter is used the Helper creates a list of EnginePages.PhotoGalleryHelperExtensions.DirectoryFile items.
Your code will need to loop through the list of items to access the desired properties of each item.
The following properties are available for each item:  
  • Title - String. The title of the file or directory.
  • Filename - String. The filename of the file or directory
  • Description - String. Description of the file or directory
  • URL - String. The relative URL or he directory or file
  • IsDirectory - Boolean. Returns true if the file is a directory and false if it is a file
  • Image - A URL for images with the height and width set in the URL
  • DateCreated - The date the file or directory was created
You can navigate to another directory by using the dir QueryString.
This Helper can easily create lists of links to all files in a directory, for example:  
@BRT.Files(directory:"files\reports",showDirectories: false, sortField:"Date",
template:
@<div>
    <h3>Click links below to view reports (.pdf files)</h3>
    <ul>         @foreach(EnginePages.PhotoGalleryHelperExtensions.DirectoryFile file in item) {
                <li>
                   <a href="@file.URL" target="_blank">
                        @if (file.Title==""){                 
                        @file.Filename
                        }
                        else {
                        @file.Title
                        }
                    </a>
                </li>
        }
    </ul>
 </div>)
Required Parameters
directory: The folder tree of the files to be listed by the Helper
Example: directory: "images/galleries/2016 Awards Ceremony"
This parameter designates a folder tree in the Brick River File system.
It is not necessary to indicate the root directory (Home directory).
For example, if target images are in the directory - Home/images/galleries/2016 Awards Ceremony - use the directory parameter as follows:
directory: "images/galleries/2016 Awards Ceremony"
Optional Parameters
showDirectories: A boolean indicator. If True a link will be created for subfolders in the current folder.
Example: showDirectories: true
If this parameter indicates: true - any subfolders contained in the target folder will be listed above and files in the target folder.
sortField: Sets the sort order of file records returned
Example: sortField: "Title"
The sortField: parameter takes one string argument to indicate the sort order of the files records.  If this parameter is not used the default sort uses the 'Title' field.
template: Applies a Razor template to data elements retrieved by the Helper
Example: template: 
            @<div>
            <h4>Meet our Authors!</h4>        
                        @foreach(EngineRecord c in item) {
                              <p><a href="/authordetail?type=@c.GetString("Name")">@c.GetString("Name") </a></p>
                }                    </div>)
The template: parameter is always an optional parameter but virtually all Helpers that create EngineRecord items use either 'template:' or 'itemTemplate:' to style and present item content.
Syntax is:
template: 
@<div>
Any valid HTML and Razor code
</div>)