dir plugin by Jacobus Geluk
Show content of current namespace, including sub namespaces and/or parent/sibling namespaces, in a table or list.
Last updated on 2008-06-28. Provides Syntax.
Compatible with DokuWiki 2006-11-06.
Requires pagelist.
Similar to dirlisting.
The Dir plugin searches a specified directory / namespace and lists the found pages in a tabular form, like the pagelist plugin. The main difference with the pagelist plugin is that the pages to be listed do not have to be specified manually. It resembles the “archive>” tag in the blog plugin, but has some different options.
The produced table of pages can be sorted. Pages with certain tags can be selected or skipped (this only works if the tag plugin is installed).
If the discussion plugin is installed, the number of comments of a page can be shown in a column. If the tags plugin is installed, the tags of a page can be shown in a column.
The dir plugin has rudimentary support for the DokuTeXit plugin in the sense that it generates LaTex output for that plugin.
~~DIR[[:<namespace>][?<flags>]]~~
| <namespace> | Can be a list, separated with semicolons, of: |
|---|---|
| . | The current namespace |
| .. | The parent namespace |
| subnamespace | The name of a sub namespace. Same as .:subnamespace |
| ..:sibling | The name of a sibling namespace. |
| <flags> | Can be any of the following, in any order: |
| cols | A semicolon separated list of column names, see “Supported Column Names” below. |
| hdrs | A semicolon separated list of column header names. |
| skip | A semicolon separated list of namespaces or page names that should be skipped. Namespaces must end with a colon. |
| tag | A semicolon separated list of tags that each page should have. Pages that do not have all these tags are skipped. A tag with a ! put in front of it means that a page with such a tag is skipped. |
| sort | A semicolon separated list of column names to be sorted, see “Supported Column Names” below. Append -ascending (default) or -descending to each column name to get the desired effect. -a and -d work too. |
| widedesc | Shows the description of each page in an additional full width row. |
| noheader | Do not show a header. |
| table | Use the table style (styling of the pagelist plugin is used) |
| list | Use the list style (styling of the pagelist plugin is used) |
| nodefaulttitle | When this flag (or ndt) is present, the titles shown in the page column will not be the default titles but the page name itself. |
| If you have one or more namespaces and some flags, do not forget to put the questionmark between them! |
| Supported Column Names | Description | Sortable |
|---|---|---|
| page | Link to the page | ✔ |
| desc | Description of the page (See also “widedesc”) | ✔ |
| description | ,, | ✔ |
| user | Full user names of the contributors | ✔ |
| userid | User id's of the contributors | ✔ |
| date | See mdate | ✔ |
| mdate | Modification date | ✔ |
| cdate | Creation date | ✔ |
| comments | Number of comments in the discussion section | ✔ |
| tags | The tags of the page | ✔ |
If you put in a line like this, you will simply get a listing of all pages in the current namespace and below:
~~DIR~~
You can also add some columns, by starting with a question mark, the specification of the namespace is skipped. The current namespace will be used:
~~DIR?cols=page;user~~
You can add your own column headers:
~~DIR?cols=page;user;comments&hdrs=Whatever;User;# Comments~~
To display a wide description of the page, below each page row, you can use the &widedesc option:
~~DIR?cols=page;user;comments&hdrs=Whatever;User;# Comments&widedesc~~
To skip a sub namespace named archive:
~~DIR?skip=archive~~
To select only pages that have the tag “important”:
~~DIR?tag=important~~
To skip pages that have the tag “concept”: (This currently only works when you also show the “tags” column, as in ~~DIR?cols=page;tags&tag=!concept~~) – jg
~~DIR?tag=!concept~~
To select pages that have the tag book and the tag ebook and not the tag fiction:
~~DIR?tag=book;ebook;!fiction~~
To sort the pages by userid with a descending creation date:
~~DIR?cols=page;user&sort=userid;cdate-d~~
To show the pages in a sub namespace called “x”:
~~DIR:.:x:~~
To show the pages in a sibling namespace:
~~DIR:..:y:~~
To show the pages in a sibling namespace with two columns, page title and user id:
~~DIR:..:y:?cols=page;user&hdrs=Page Title;User ID~~
Download the plugin-dir.tgz file in the lib/plugins directory and unzip it, it will put a file called syntax.php in the lib/plugins/dir directory. This plugin requires the pagelist plugin and will use the plugins discussion and tags if they are installed.
You can also use the plugin manager to download and install the plugin, use this url:
http://www.skateboardmaniaks.nl/_media/plugin/plugin-dir.tgz
Thanks for the work, the plugin works basically fine. Only the dates are always set at '01.01.1970' (following my date format string 'd.m.Y'). Any hints? — breg, 31.10.2007 17:28
The dates are taken from each page with the p_get_metadata function, which is a function of the Dokuwiki itself. So the dir plugin does not produce these dates itself. — jg
Nice work, but what's the syntax for listing a subcategory?
For example what should I write to list all the subpages of A:B:* ?
~~DIR:A:B~~
That would have to be: — jg
~~DIR:.:A:B~~
I'm trying to use this plugin with version 2007-06-26b.
When I simply insert ~~DIR~~ it properly lists pages on my test install; however, when I try to use a more advanced function (such as ~~DIR:cols=page;user;mdate~~) it tells me “There are no documents to show.” Is there some kind of compatibility issue with 2007-06-26b?
Not that I know of. In the 2008-02-25 version of the plugin I changed the syntax a little bit, the namespace specification should start with a colon and the specification of any flags should start with a questionmark. So, your statement should like like this: — jg
~~DIR?cols=page;user;mdate~~
Hello, i install, and work fine.. but, i need the names of pages without underline; example, pagetitle is hello_world,
but i want show “Hello world”. its possivel?
Thanks for the plugin! I am trying to get pages sorted by title (first header, not file name) but I don't see a way to do that. Am I missing it? sort=page gives me filename order. Here is how I invoke it:
~~DIR?sort=page-a&hdrs=additional topics~~
Hi, the download archive seems to be broken (8b).
Hi
1: Shouldn't the start-pages be listed in the same level as all other pages in the namespace? In the current implementation, the start-page of a subnamespace is on the same level as all pages of the current namespace, whats kinda cunfusing.
2: Could the namespace-names be shown in the tree-view or as a column? I find it confusing to have a tree full of starts, if I have many start-pages.
3: I think there is an issue about security and ACL. Pages not accessible for the current user should not be listed (especially the description can contain confidential information).
4: Whats the syntax to get a list of all pages (=root namespace) independent of current namespace? Solved, itsDIR::
5: where does desc come from? Seems to me it's the unformatted content of the page? Shouldn't it be the given revision description?
6: user and userid have valid content only if the specific page had been edited at least once (not only created)
Thanks for considering
— Benny Wegner 2008/07/14 01:23