Description

I tried out the Blog plugin by Esther Brunner and it is a wonderful product. However, there is one shortcoming: it looks up the data from the change log.

I know it is needed for the performance reason. However, if the namespace is small, it is also reasonable to get the list of new files from the file system directly. And, sometimes, I love this way more! So I wrote this plugin.

This Plugin get a list of recently changed wiki pages of a given namespace as the Blog plugin does. However, it has the following syntax:

{{content>[namespace]?[number[&options[&options..]]]}}

[namespace] is a namespace in your wiki; defaults to the top namespace
[number] is the number of entries to show; default is 5
[options] is the option applied. Separated by the & character

All the three parameters are optional. The valid list of options are:

recursive - Include the pages recursively under the namespace
showpage - Show the page content, up to the first horizontal rule
noshowpage - Do not show the page content, show only the title
filesystem - Scan for the recently changed file from the file system
changelog - Scan for the recently changed file from the changelog

The title that used by the “showpage” or “noshowpage” options are defined as the first <h1> enclosed string. Similar to the Blog plugin and table of contents tags will be stripped and below the entry the username and the date of the last change is displayed if “showpage” option is given.

If the “noshowpage” option is given, however, the recently changed wiki pages will be shown as unordered lists. With the title, file name, and change date shown.

Code

Create a directory lib/plugins/content/ and put the following file as syntax.php to use.

Change History

Updated to include the fixes by Markus Aittola and Johannes Zarl. Now works for the most recent release (2006-03-09b)

2006-08-08:

Minor bug fix: Changed line 104 (getRecents call) to reflect the change in the function prototype in the recent releases.

Options

After your creation of lib/plugins/content/syntax.php, make sure you include the following lines into conf/local.php as defaults options:

// Content plugin$conf['content']['showpage']=true;// By default, show the page$conf['content']['scanmode']=true;// By default, scan the filesystem for the list

Discussion

A usable plugin, thank you. I think I found a bugs, though, from handling the number of shown entries. It returns the specified number of entries only if you are using changelog option. Fixed that adding following into the render() function: