Files Helper

Last Updated 3/3/2015
List files in any of the Files directories

Add this in @BRT.Files(directory:"photo_galleries/somegallery")

and it will create a list of files.

Required parameter include:

  • directory (string) - You can find the directory's full name by going to files, select show properties. The value you want is found after name:

Optional parameters include:

  • template (Razor template) - Customize the layout of the files. Reference the code below.
  • showDirectories (boolean) - Shows a listing of all child directories above any files.
  • sortField (string) - Sort order for the files. Choose "Title" (order by title or filename ascending) or "Date" (order by date modified, descending); the default is "Title".

Default Code



Using a Template

You can use a template to format the fiels helper to fit your needs. You will need to to loop through the list of  EnginePages.PhotoGalleryHelperExtensions.DirectoryFile in the item to access the file properties.

The following properties are available for files

String. The title of the file or directory.

String. The filename of the file or directory

String. Description of the file or directory

String. The relative URL or he directory or file

Boolean. Returns true if the file is a directory and false if it is a file

A URL for images with the height and width set in the URL

The date the file or directory was created

Navigating Directories

You can navigate to another directory by using the dir QueryString.

Templated Code

@BRT.Files(directory:"photo_galleries/annual_conference_2013",showDirectories: true, sortField:"Date", template:
     @foreach(EnginePages.PhotoGalleryHelperExtensions.DirectoryFile file in item) {
         if(file.IsDirectory == true) {
             <h3><i class="folder"></i> <a href="?dir=@file.URL">
                  @if (file.Title==""){
                  else {
         else {  
                       <i class="file"></i> <a href="@file.URL" target="_blank">
                            @if (file.Title==""){
                            else {
                       <span class="text-muted">@(file.DateCreated.Substring(4, 2) + "/" + file.DateCreated.Substring(6, 2)  + "/" +   file.DateCreated.Substring(0, 4)) </span><br/>

Article Topics

For Developers

Want to learn more?

Call 800-924-5220 or

Schedule a demo