Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nfourtythree/craft-directory-contents
adds variable to return array of given directory content
https://github.com/nfourtythree/craft-directory-contents
craft-plugin craftcms craftcms-plugin
Last synced: about 1 month ago
JSON representation
adds variable to return array of given directory content
- Host: GitHub
- URL: https://github.com/nfourtythree/craft-directory-contents
- Owner: nfourtythree
- Created: 2016-02-10T10:53:48.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-13T20:24:35.000Z (almost 9 years ago)
- Last Synced: 2023-03-12T07:37:22.587Z (almost 2 years ago)
- Topics: craft-plugin, craftcms, craftcms-plugin
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Direct Contents plugin for CraftCMS
Adds `craft.directoryContents.read("path/to/directory")` variable to templates allowing passing of a directory.
The variable returns a recursive array of the directories contents.
Currently supported parameters are `path` and `ignoreFiles`. Only `path` is required.
By Default `ignoreFiles` only ignores `.DS_Store`
Very early release.
## Installation
1. Download Zip
2. Drop `directorycontents` in your plugins folder
3. Install
4. Go Go Go## Usage
```
// Template Tag
{% set files = craft.directoryContents.read("path/to/directory") %} // return array// or
{% set options = {
path: "path/to/dir",
ignoreFiles: [".DS_Store", ".gitignore", "example.txt"]
} %}
{% set files = craft.directoryContents.read(options) %}```
### TODO
- ADD ALL THE OPTIONS (e.g. depth, file type etc)