Directory Contents

Overview

This plugin simply recurses a directory on the file system and displays the contents of a directory and it's children as a link tree. There are options to generate your own display of a single directory as well as a full tree - even with images being displayed.

Usage

{exp:directory_contents:links
    src="path"
    exclude_ul="no"
    css_id=""
    css_class=""
    depth="0"
    add_level_class="no"
    add_span="no"
    images_inline="no"
    ignore_pattern=""
    sort_with="sort"
}

  • path Required. Relative to doc_root or system path
  • exclude_ul Optional. If "yes", do not set containing <ul> tag (disables recursion as well)
  • css_id Optional. The value to assign to id attribute of the containing <ul>
  • css_class Optional. The value to assign to the class attribute of the containing <ul>
  • depth Optional. If set, shows a maximum of that many child <ul>
  • add_level_class Optional. If "yes" adds a class to <li> elements starting at "level_1"
  • add_span Optional. If "yes" generates links like <a href="path"><span>text</span></a>
  • images_inline Optional. If "yes" will generate <img> tags for image types rather than simply link them.
  • ignore_pattern Optional. A Perl regular expression to use to match against a file/directory name to exclude from the output.
  • sort_with Optional. The name of the supported funtion to use to sort the directory contents with. one of: sort, rsort, natcasesort, natsort, shuffle

NOTE: You may use custom HTML for the image tag generation. For example:
{exp:directory_contents:links src="path" images_inline="yes"}
    <div><a href="{DC_img_url}" rel="prettyPhoto"><img src="{DC_img_url}" /></a></div>
{/exp:directory_contents:links}

If you do not want to make links, you can also use the parse tag:
{exp:directory_contents:parse src="path"}
    {is_dir}
    {name}
    {uri}
{/exp:directory_contents:parse}

Current Version Information

The most up-to-date files can be found via the GitHub repository for this project.

Comments, ratings, etc. can be found on the Devot-ee Add-on Page.

package Directory Contents
version 1.1
author Justin Koivisto
copyright Copyright © 2012 Justin Koivisto
license LGPL
link http://koivi.com/ee-directory-contents

Changelog

  • 1.1 Added ignore_pattern and sort_with features.