Plugin Directory

WP List Files

JavaScript

If you want subdirectories to be collapsed on page load, you'll have to make a minor ajustment to your theme, especially header.php. You'll have to add wplfCollapseAll() to the body tag's onload attribute, so that it looks something like this:

<body onload="wplfCollapseAll()">

Or this:

<body onload="someFuntion();wplfCollapseAll()">

Advanced usage

/linkto is useful if you want to play with .htaccess and mod-rewrite and you want your files to appear "inside" a page.

For instance, you use 'nice' permalinks and you have a page /files/ that lists a buch of files and want those files to be accessible like /files/image.jpg. Since the directory "/files/" doesn't really exist (it's a WordPress page, after all), you'll have to put those files somewhere else.

In this case, you could insert

<!--list files "/path/to/files" "/files"-->

in your post or page, and a rewrite rule in your .htaccess that would look something like this:

RewriteRule ^files/(.+)$ /path/to/files/$1 [L]

That would generate a list of all the files in /path/to/files, and make the links point to /files, so /path/to/files/image.jpg would be linked as /files/image.jpg. The rewrite rule will then translate that back to /path/to/files/image.jpg, and the webserver will serve the user that file.

Version history

  • 2.3 (2008-06-22)
    • JavaScript rewritten again, no more jQuery as it caused too much compatibility problems
  • 2.2 (2009-10-05)
    • JavaScript rewritten, now uses jQuery library
  • 2.1.1 (2007-09-28)
    • Clearer documentation on how to enable JavaScript, it will now also not work if disabled
  • 2.1 (2007-09-19)
    • Fixed a bug where the "expand/collapse all" links wouldn't work in MSIE
  • 2.0 (2007-09-17)
    • Refactored the code
    • Removed some (what I believed to be) superfluous options
    • Added back alphabetic sorting, directories are always displayed on top
    • Added an option to include a JavaScript that allows collapsing and expanding of directories
  • 1.4 (2007-08-23)
    • Will now also do more than one listing per page/post
  • 1.3 (2007-08-22)
    • Put a limit on how deep the recurse can go (defaults to 5 levels)
    • Added some options to set that limit and to control how the list is generated
  • 1.2 (2007-08-20)
    • Will now walk though directories recursively and display them as nested lists (thanks to Guoqiang Shen for the suggestion)
    • Removed sorting option for now, got too complicated
  • 1.1 (2007-07-10)
    • Added option to set whether to sort files alphabetically or leave them in the order presented by the file system
  • 1.0 (2007-07-03)
    • Initial release

License

Copyright (c) 2007-2008 Colin Helvensteijn <helvensteijn.com>

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(4 ratings)