Skip to content

Usage

Snippets

There are three snippets included in the package.

FileDownload

This snippet will display a list of files from one or multiple directories. It uses the following properties:

Property Description Default
ajaxContainerId The container id of the AJAX element. file-download
ajaxControllerPage The resource id of the MODX resource used as AJAX connector. -
ajaxMode Enable the AJAX mode of the snippet. 0 (No)
breadcrumbSeparator Separator string between the parts of the breadcrumb. 0 (No)
browseDirectories Enable browsing of subdirectories in the specified directory. 0 (No)
chkDesc Name of a chunk that contains the descriptions for the listed files. Files and descriptions have to be listed in the chunk using the following format: path to file/filename|description|| -
countDownloads Enable the download count in the database. 1 (Yes)
countUserDownloads Enable the download count by user in the database. 0 (No)
cssAltRow This class that will be added to each second row in the template chunks. fd-altRow
cssDir This class that will be added to all directory entries in the template chunks. fd-dir
cssExtension Enable adding a class to each file in the template chunks according to the file extension. 0 (No)
cssExtensionPrefix Prefix added to the cssExtension class. fd-
cssExtensionSuffix Suffix added to the cssExtension class. -
cssFile This class that will be added to all file entries in the template chunks. fd-file
cssFirstDir This class that will be added to the first directory entry in the template chunks. fd-firstDir
cssFirstFile This class that will be added to the first file entry in the template chunks. fd-firstFile
cssGroupDir This class that will be added to a directory entry for multi-directories grouping in the template chunks. fd-group-dir
cssLastDir This class that will be added to the last directory entry in the template chunks. fd-lastDir
cssLastFile This class that will be added to last file entry in the template chunks. fd-lastFile
cssPath This class that will be added to the path in the template chunks when using directory browsing. fd-path
dateFormat PHP date format for each file in the output. Y-m-d
deleteGroups Comma separated list of user group names. Enable the delete link for users that belong to the specified groups. -
directLink Use the direct url of the file, rather than the hashed link. Make sure that the url is web accessible. 0 (No)
downloadByOther Disable the download action of this snippet and use a different way. 0 (No)
extHidden Comma-separated list of file extensions used to exclude files from the displayed list. -
extShown Comma-separated list of file extensions used to include files in the displayed list. -
fileCss Path of a CSS file that is registered in the HTML output in the frontend. Set to disabled, to disable the registering. -
fileJs Path of a JavaScript file that is registered in the HTML output in the frontend. -
getDir Specify the directories displayed in the snippet output. Multiple directories can be specified with a comma-separated list. When multiple directories are specified the directory browsing functionality is disabled. -
getFile Specify the file displayed in the snippet output. The getDir parameter is still required and getFile has to be a file inside of the directory. -
groupByDirectory Enable grouping the files by directory when multiple directories are specified in the getDir parameter. The tplGroupDir template will be added above each group. 0 (No)
imgLocat Path to the images associated with each file extension. The images are output in the [[+fd.image]] placeholder. -
imgTypes Name of a chunk that contains the association between file extensions and and images. fdImages
mediaSourceId The files and directories are searched relative to the base path of the specified media source. -
noDownload If you enable this property, files will be displayed without download link in the list. 0 (No)
prefix Prefix for the placeholders in the template chunks. fd.
saltText With this text the file path will be extended to be able to create individual hashes for the file download. FileDownloadR
showEmptyDirectory Show directories even when they are empty. 0 (No)
sortBy Sort type of the files. When directory browsing is enabled the directories are displayed first in the list. When multiple directories are specified and the group by directory feature is used, the files are sorted by each directory path first. filename
sortByCaseSensitive Case sensitive option for sorting. 0 (No)
sortOrder Sort order. asc
sortOrderNatural Sort by natural order. 1 (Yes)
toArray Returns the snippet result with print_r without parsing the templates. 0 (No)
tplBreadcrumb Name of a chunk that is used as breadcrumb item template. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdBreadcrumbTpl
tplDir Name of a chunk that is used as a directory template. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdRowDirTpl
tplFile Name of a chunk that is used as a file row template. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdRowFileTpl
tplGroupDir Name of a chunk that is used as a template of the directory path if the &groupByDirectory is enabled. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdGroupDirTpl
tplIndex Name of a chunk that is used as a index.html template to hide the download directories. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdIndexTpl
tplNotAllowed Name of a chunk that is used as a forbidden access template. The login snippet or a redirect to the login page can be used here. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdNotAllowedTpl
tplWrapper Name of a chunk that is used as container template of all of the snippet's results. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdWrapperTpl
tplWrapperDir Name of a chunk that is used as container template for directories. @BINDING is possible (@INLINE/@FILE/@CHUNK). -
tplWrapperFile Name of a chunk that is used as container template for files. @BINDING is possible (@INLINE/@FILE/@CHUNK). -
uploadFile Enable the file upload. 0 (No)
uploadFileTypes Comma separated list of mime types or extensions to restrict the upload. image/gif,image/jpeg,image/png
uploadGroups Comma separated list of user group names. Show the file upload for users that belong to the specified groups. -
uploadMaxSize Maximum upload size in bytes. 2000000
userGroups Comma separated list of user group names. This will show the file list for users that belong to the specified groups. Users that don't not belong to this group or are not logged in will receive a message specified in the tplNotAllowed property. -

To use the downloadByOther property of the FileDownload snippet, you can read the AJAX example usage

FileDownloadCount

This snippet will display the download count of one directory. It uses the following properties:

Property Description Default
countDownloads Enable the download count in the database. 1 (Yes)
countUserDownloads Enable the download count by user in the database. 1 (Yes)
fileCss Path of a CSS file that is registered in the HTML output in the frontend. Set to disabled, to disable the registering. -
fileJs Path of a JavaScript file that is registered in the HTML output in the frontend. -
getDir Specify the directory displayed in the snippet output. -
mediaSourceId The files and directories are searched relative to the base path of the specified media source. -
prefix Prefix for the placeholders in the template chunks. fd.
saltText With this text the file path will be extended to be able to create individual hashes for the file download. FileDownload
toArray Returns the snippet result with print_r without parsing the templates. 0 (No)
tpl Name of a chunk that is used as a download link template. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdSingleDirTpl
userGroups Comma separated list of user group names. This will show the file list for users that belong to the specified groups. Users that don't not belong to this group or are not logged in will receive a message specified in the tplNotAllowed property. -

This snippet will display a single download link for one file. It uses the following properties:

Property Description Default
ajaxContainerId The container id of the AJAX element. file-download
ajaxControllerPage The resource id of the MODX resource used as AJAX connector. -
ajaxMode Enable the AJAX mode of the snippet. 0 (No)
chkDesc Name of a chunk that contains the descriptions for the listed files. Files and descriptions have to be listed in the chunk using the following format: path to file/filename|description|| -
countDownloads Enable the download count in the database. 1 (Yes)
countUserDownloads Enable the download count by user in the database. 0 (No)
dateFormat PHP date format for each file in the output. Y-m-d
directLink Use the direct url of the file, rather than the hashed link. Make sure that the url is web accessible. 0 (No)
fileCss Path of a CSS file that is registered in the HTML output in the frontend. Set to disabled, to disable the registering. -
fileJs Path of a JavaScript file that is registered in the HTML output in the frontend. -
getFile Specify the file displayed in the snippet output. -
imgLocat Path to the images associated with each file extension. The images are output with the placeholder [[+fd.image]]. -
imgTypes Name of a chunk that contains the associations between file extensions and and images. fdImages
mediaSourceId The files and directories are searched relative to the base path of the specified media source. -
noDownload Display only files without their download link in the list. 0 (No)
prefix Prefix for the placeholders in the template chunks. fd.
saltText With this text the file path will be extended to be able to create individual hashes for the file download. FileDownload
toArray Returns the snippet result with print_r without parsing the templates. 0 (No)
tpl Name of a chunk that is used as a download link template. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdSingleFileTpl
tplNotAllowed Name of a chunk that is used as a forbidden access template. The login snippet or a redirect to the login page can be used here. @BINDING is possible (@INLINE/@FILE/@CHUNK). fdNotAllowedTpl
userGroups Comma separated list of user group names. Show the file list for users that belong to the specified groups. Users that don't belong to these groups or that are not logged in will receive a message specified in the tplNotAllowed property. Multiple groups can be specified by using a comma-separated list. -

System Settings

FileDownloadR uses the following system settings in the namespace filedownloadr.

Key Name Description Default
filedownloadr.email_props Email Properties JSON encoded array of email properties for the FileDownloadEmail plugin. -
filedownloadr.exclude_scan Exclude Files Comma-separated list of filenames to be excluded during scanning. .,..,Thumbs.db,.htaccess,.htpasswd,.ftpquota,.DS_Store
filedownloadr.ipinfodb_api_key API Key of IPInfoDB.com Get the API Key from https://ipinfodb.com/. -
filedownloadr.use_geolocation Use Geolocation by IP Use geolocation by IPInfoDB.com. No