ListFiles module (Files module Improvements)
nav_first.pngFirst: thread:131
HTML Block
Edited: 11 Oct 2012 12:06 by: GoVegan
Comments: 0
nav_prev.pngPrevious: thread:126
Data Forms
Edited: 04 Jun 2010 15:03 by: leiger
Comments: 5
Last: thread:112
Image Module
Edited: 12 Nov 2009 12:22 by: pieterh
Comments: 0
Next: thread:119
The Wikidot Data Model
Edited: 22 May 2010 01:47 by: leiger
Comments: 0

leigerleiger wrote on 20 Mar 2010 09:36

The Files module should allow the user to restrict it's results to show only specific extensions. It should also be renamed to be the "ListFiles" module.

This design assumes that the module only displays files displayed on the same page as the module, and that multiple modules can be placed on the same page.


[[module ListFiles file_extension="zip 7z rar"]]
[[module ListFiles file_type="images"]]

Selecting files

Specify one or more of these selectors to refine the set of files that this module displays. Each selector adds additional constraints:

Argument Meaning
file_type Select by type of file
file_extension Select by file extension
created_at Select by date uploaded
created_by Select by uploader's screen name
category Select by category (works the same as in ListPages)
page Select by page (works the same as in ListPages)

Note: All ListPages arguments should be supported. The only difference is that the ones listed above have a slightly different implementation when used in the ListFiles module.

File type selector:

  • "*" means all files, ignoring file type (default)
  • "images" means images
  • "files" means everything except images

File extension selector:

  • "*" means all file extensions
  • else, a list of space/comma delimited file extensions
  • file extensions are by default additive (ext OR ext OR ext)
  • "-ext" means exclude files with this extension (AND NOT)

Creation date selector:

  • "=" means uploaded on same day as the page was created
  • "yyyy" means specified year
  • "" means specified year and month
  • "last n unit" where 'n' is a count (defaults to 1) and unit is "hours", "day", "week", or "month"
  • optionally prefixed by ">", "<", "=", "<=", ">=", "<>" (default is "=")
  • dates are not site-local but currently all UTC (GMT)

Created by selector:

  • "=" means by uploaded by author of current page
  • "-=" means by not uploaded by author of current page
  • else, a single user name

Category selector:

  • "." current page category (default)
  • "*" all categories (equivalent to page="*")

Page selector:

  • "." current page (default)
  • "*" all pages (equivalent to category="*")

Ordering pages

To order the pages, use:

Argument Meaning
order Specify order criteria

Order criteria:

  • "property" means "ascending by this property"
  • optionally followed by " desc" meaning "descending"
  • optionally followed by " desc desc" meaning "ascending", which makes "desc" safe to add after any sort order
  • default is "created_at desc"
Property Meaning
name Order by file name
created_at Order by date uploaded
created_by Order by uploader's screen name
size Order by file size
random Order randomly, cached for 60 seconds

For example to order by file size in descending order:

order="size desc"

Note that "property asc" is not allowed and unknown order criteria give you the default order, which is "created_at desc".

Arguments that affect the module body

The body of the module allows you to specify how page properties and content is formatted. To control this formatting, you can use these module arguments:

Argument Meaning
manageLink Show the link "Manage attachments"?

Manage attachments link specifier:

  • "yes"|"true" means show the link.
  • "no"|"false" means hide the link (users can still click on "files" in page options).
  • default is "yes".
  • This only works when page=".", otherwise the attribute is ignored

Variables that are used in the module body

All arguments listed above should have corresponding variables in the module body. For example: %%file_type%% and %%file_extension%%

Start a new sub-thread

We discourage direct comments on this thread: to discuss it, please start a sub-thread.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License