Jump to content

Extension:ListItemFilter

From mediawiki.org
MediaWiki extensions manual
ListItemFilter
Release status: unmaintained
Implementation Special page
Description Mediawiki special page to list filtered list items of wiki pages.
Author(s) Tim Janik
Latest version 0.0.1 (2012-11-23)
MediaWiki 1.19.2
License GNU General Public License 2.0
Download
README

Extension for a Mediawiki special page to list filtered list items of wiki pages.

About

[edit]

The ListItemFilter extension adds a special page Special:ListItemFilter to your MediaWiki, it takes the name of a wiki page as subpage and a list of keywords as filter arguments. Special page usage examples:

Example output:

Extension Usage Result Explanation
http://mediawiki.example.com/wiki/Special:ListItemFilter/SomeWikiPage?k=URGENT:,IMPORTANT: Link to a Mediawiki special page with all list items containing "URGENT:" or "IMPORTANT:" from the wiki page SomeWikiPage.
{{Special:ListItemFilter/SomeWikiPage?k=URGENT:,IMPORTANT:}}
Usage for template inclusion from within the SomeWikiPage wiki page. Provided such list items exist in the SomeWikiPage page, this is expands into:
  • URGENT: Shop for salad and milk.
  • IMPORTANT: File taxes before end of December.

Usage

[edit]

The URL syntax and the template syntax to use the ListItemFilter special page are as follows:

<SpecialPageURL> / <PAGENAME> ?k= <KEYWORD> [,<KEYWORD>]
{{Special:ListItemFilter/ <PAGENAME> ?k= <KEYWORD> [,<KEYWORD>] }}

So, if the Wiki is located at mediawiki.example.com/wiki and we need all list items containing "fruits" of the "Shopping List" wiki page, we would use:

http://mediawiki.example.com/wiki/Special:ListItemFilter/Shopping_List?k=fruits
{{Special:ListItemFilter/Shopping_List?k=fruits}}

Download & Installation

[edit]

Check out the source code from the GitHub repository into your Mediawiki extensions directory, example:

cd $IP/extensions/Mapsources/
git clone git://github.com/tim-janik/ListItemFilter.git

To install and use this extension, add the following to LocalSettings.php :

# Special:ListItemFilter extension
require_once ("$IP/extensions/ListItemFilter/setup.php");

Note that it makes sense to have php5-tidy installed for this extension. For non-trivial list items, Tidy is used by the extension to validate and produce correct HTML output. On Debian like systems, this can be done with:

apt-get install php5-tidy