Provides a CSS style-able directory listing. The plugin includes a bunch of filetype icons.
Now with a configuration page to specify the directory path and URL, as well as any file-types to be ignored in the directory listing.
Updated from RobA's original plugin.
- Unzip the file to your plugin directory.
- Navigate to the Plugins Tab, and select the SimpleDir Settings menu items.
- Complete the Full Server Path to Directory and the Base URL for Directory and save the settings to set the properties for all SimpleDir instances globally. Leave them empty to default to your
data/upload/path. - Optionally, add a comma separated list (no spaces) of the extensions to not display.
There is also a css file in the simpledir subdirectory that can be used as a template for styling the table.
-
Create a page and include
(% simpledir %)on that page - this will be replaced with a table. Parameters given below.(% simpledir %) -
Outside of pages, use function
get_simpledir_display- API details given below.<?php get_simpledir_display(); ?>
Additional parameters for the (% simpledir %) shortcode (separated by |):
dirpath: path relative to global path given in the admin panel.urlpath: path relative to the global URL path for the subdirectories.ignore: comma separated list (no spaces) of extensions to ignore, e.g.php,htaccess. Leave empty to use value given in admin panel.key: alphanumeric identifier (used in the URL query string) to distinguish this instance of SimpleDir, e.g.subdir2. Needed if you have multiple instances of SimpleDir on the same page.columns: comma separated list (no spaces) of columns to include, e.g.name,date,size. Leave empty to default toname,date,size.order: +/- for ascending/descending, followed by column to sort on, e.g.-datefor latest file first. Leave empty for+name.showfilter: set totrueto show a search field for filtering files in the current directoryshowinitial: number of files to show initially. Set to0to show allsortable: set totrueto allow user to sort files by columnLABEL_NAME: label for theNamecolumnLABEL_SIZE: label for theSizecolumnLABEL_DATE: label for theDatecolumn
// Shows all files in /data/uploads/
(% simpledir key="subdir1" %)
// Shows all files in /data/uploads/images
(% simpledir key="subdir2" | dirpath="images/" | urlpath="images/" %)
// Shows all non-png files in data/uploads/
(% simpledir key="subdir3" | ignore="png" %)
get_simpledir_display($params = array()): prints out a table of the contents of$dirpath.$paramsis an array with the following keys:dirpath: same asdirpathabove.urlpath: same asurlpathabove.ignore: array of extensions to ignore, e.g.array('php', 'htaccess')key: same askeyabove.columns: same as above, but an array.order: same as above.showfilter: same as above.showinitial: same as above.sortable: same as above.LABEL_[NAME]: same as above.
return_simpledir_display($params = array()): returns a string of the table. Same arguments asget_simpledir_displayreturn_simpledir_results($params = array()): returns an array of the contents of a given directory$paramsis an array with the following parameters:dirpath: same asdirpathabove.urlpath: same asurlpathabove.ignore: same asignoreabove.order: same as above.
- Returned is an array with the following keys:
subdirs: array of subdirectories; each an associative array with keysname,datefiles: array of files, each an associative array with keysname,date,size,typetotal: total size of the files in this directory
- Rob Antonishen for the original plugin
- DesruX for suggestions and beta testing
- DataTables for the jQuery plugin used give client-side functionality to the directory listing