Jump to content

DynamicPageList2

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Lcarsdata (talk | contribs) at 16:04, 27 October 2006 ({{MoveToMediaWiki}}). It may differ significantly from the current version.
 
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

Template:Extension

DynamicPageList2 is a Mediawiki extension developed for use on Wikinews (but not yet installed there), but it can be installed on any wiki. It allows wiki users to dynamically create lists of pages that are listed in a set of categories or namespaces using logical AND and OR.

DynamicPagelist2 vs. DynamicPageList

This is a hack of the original DynamicPageList extension featuring many Improvements (see below). Note that it's called DynamicPageList2 for distinction of DynamicPageList. You can use both extensions at the same time, because the new tag is DPL instead of DynamicPageList.

With DPL2 you have much more freedom when generating dynamic article lists by using AND and OR with categories. Moreover, there are much more display options to set.

Source and Installation

Latest version: 0.7.7.

First download the source from (2 possible locations):

  • svn.wikimedia.org (for latest/development version)
DynamicPageList2.php: Main file.
DynamicPageList2.i18n.php: Required by DynamicPageList2.php, internationalization file used for all DPL messages.
  • Alternative location: svnweb.tuxfamily.org (for latest or older releases)
Development version: Browse - Tarball
Older releases: Browse. RELX_Y_Z means version X.Y.Z. Use the Tarball link on the right to download.

(Version 0.3.3: http://tucholsky.diebin.at/~fabian/DynamicPageList2.php.txt)

To install it, put the file in your extensions/ directory, and add require_once("extensions/DynamicPageList2.php"); to your LocalSettings.php file.

For v0.7.0 and later, if you want to apply the 'category' parameter on the Uncategorized pages, you are required to execute this manual query on your MediaWiki database, replacing prefix with your prefix if any:

CREATE VIEW prefix_dpl_clview AS 
 SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey 
  FROM prefix_page LEFT OUTER JOIN prefix_categorylinks ON page_id=cl_from

For MediaWiki 1.8.x, see DynamicPageList2#MediaWiki_Version.

If you are using this extension with IIS on a Windows box, make sure to give Read & Execute rights to the user IUSR_MACHINENAME (Anonymous Internet Guest Account) for the extensions directory and the DynamicPageList2.php file itself.

Authors

MediaWiki Version

  • DPL2 v0.6 and later: MediaWiki 1.7.1 minimum for internationalization. (more info...).
For MW 1.8.x, change the code (line 1024 in v0.7.7) from
return CategoryPage::columnList( $subaArticles, $subaArticles_start_char );
to
return CategoryViewer::columnList( $subaArticles, $subaArticles_start_char );
and on line 1027 from
return CategoryPage::shortList( $subaArticles, $subaArticles_start_char );
to
return CategoryViewer::shortList( $subaArticles, $subaArticles_start_char );
  • DPL2 v0.5.1: See test on MediaWiki 1.7 by gandm.
  • DPL2 v0.5.x: Tested (mostly) successfully on Mediawiki 1.6.7.

Not compatible with Mediawiki 1.5.x. The extension uses (needs) more than two parameters and WikiMedia 1.5.x provides only two.

Bug report

Before reporting bugs, view old ones on the discussion page. For more recent ones, make an advanced search on MediaZilla. Select Product: MediaWiki extensions, and Component: DynamicPageList2.

Report new bugs on MediaZilla. Select Product: MediaWiki extensions, and Component: DynamicPageList2.

Note: if you have installed DPL2 on a public site, you are invited to add it to the list of sites using DPL2. Thank you.

Feature request

View old requests and request features on the discussion page.

Sites using DPL2

Please supply the list below with links to wikis where DynamicPageList2 is installed, and if possible, specific pages where we can see it in action. This is useful for users who do not have their own wiki installation have a live demo of its features. We appreciate it.

Here are some links where DynamicPageList2 is being used (check the Special:Version page to get the version):

Usage of DynamicPageList2

To use DPL, use the following XML-like syntax on your wiki page:

<DPL>
...parameters...
</DPL>

The output of this would be something like: (depending on the outputmode you select)

You can nest DPL in a static list on your wiki page:

<ul>
  <li>Item1</li>
  <li>Item2
    <DPL>
      ...parameters...
    </DPL>
  </li>
</ul>

The list of pages being output, as well as the order and display mode of the list has to match the defined parameters.

The following lists parameters and their effects

category

Purpose:

Include pages in the union of given categories. You can specify more than one category with the pipe '|' as a separator, with the effect that the pages listed have to be at least in one of the categories (logical OR). If you specify the 'category=' parameter more than once, the pages listed have to match all these parameters (logical AND).

Syntax:

category=1st category name|2nd category name|3rd category name|...

Example 1:

<DPL>
category=Africa|Europe
category=Politics and conflicts
</DPL>

This list will output pages that have [[Category:Africa]] OR [[Category:Europe]], AND [[Category:Politics and conflicts]] listed.

v0.7.0 - You can specify the set of Uncategorized pages as a normal category, with an empty string (e.g. 'category=' for uncategorized pages only, 'category=|Animals' or 'namespace=Animals|' for the Uncategorized or the Animals category, 'category=Mammals||Insects' for the Mammals category, uncategorized pages or the Insects category, etc.). See Source and Installation for the extra required installation steps.

v0.7.7 - If ordermethod=category,... and headingmode are enabled, you can restrict the categories you want as headings in the result by preceding the list of categories (specified with the category parameter) with a '+'. See the example below.

Example 2:

<DPL>
category=+Africa|Europe
category=Politics and conflicts
ordermethod=category,sortkey
headingmode=ordered
</DPL>

This list will output pages that have [[Category:Africa]] OR [[Category:Europe]], AND [[Category:Politics and conflicts]] listed. The list will be ordered (OL tag) and organized in 2 main items/headings: the Africa one and the Europe one (Politics and conflicts will not be used as a heading). Under each item/heading, a sublist of pages ordered by their sortkey for the category used as heading.

Notes:

You may use Magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name, as long as they do not contain the character "|".

Related extension variables (more info): $wgDPL2MaxCategoryCount, $wgDPL2AllowUnlimitedCategories, $wgDPL2MinCategoryCount.

notcategory

Purpose:

Much like the category parameter, but requires that every page listed not be in a particular category. Unlike in 'category' you cannot combine several categories using logical OR in this parameter.

Syntax:

notcategory=category name

Example:

<DPL>
category=Africa
notcategory=Zimbabwe
notcategory=Kenya
</DPL>

This list will output pages that have [[Category:Africa]] but do not have either [[Category:Zimbabwe]] or [[Category:Kenya]] listed.

Notes:

You may use Magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name.

Related extension variables (more info): $wgDPL2MaxCategoryCount, $wgDPL2AllowUnlimitedCategories, $wgDPL2MinCategoryCount.

namespace

Purpose:

To restrict the articles in the list to only be in one of the given namespaces.

v0.7.7 - Magic words supported. See Help:Magic_words#Page_names_and_related_info and Help:Magic_words#Namespaces_and_URLs for relevant magic words.

Syntax:

namespace=1st namespace name|2nd namespace name|3rd namespace name|...

The namespace name may be anyone, assuming it represents a valid namespace in the system, including custom ones, BUT no pseudo-namespace such as Media, Special which have negative namespace ids. See Help:Namespace. The empty string is the main article namespace (e.g. 'namespace=' for pages in Main ns only, 'namespace=|Help' or 'namespace=Talk|' for Main or Talk ns, 'namespace=User||Category' for User, Main or Category, etc.).

Namespace ids are no longer allowed as namespace arguments, because it caused a conflict between namespace given a number as name on one hand, and namespace with that same number as namespace id on the other hand. E.g. if you created a custom namespace with '1' as title (yes, it's possible), namespace=1 would give you pages in '1' and not pages in namespace with id=1 (Talk). In that case, you could not get pages in the Talk ns anymore. Solution: use only ids or only names. Names are more user-friendly.

Example 1:

<DPL>
category=Policy
namespace=Wikinews|Discussion
</DPL>

This list will output pages that are in the Wikinews or Discussion namespace and belong to [[Category:Policy]].

Example 2 (with magic word):

<DPL>
category=Policy
namespace={{NAMESPACE}}
</DPL>

This list will output pages that are in the namespace the current page is in - whatever it is - and belong to [[Category:Policy]].

notnamespace

Purpose:

Much like the notcategory parameter, but for namespaces. Requires that every page listed not be in one of given namespaces.

v0.7.7 - Magic words supported. See Help:Magic_words#Page_names_and_related_info and Help:Magic_words#Namespaces_and_URLs for relevant magic words.

Syntax:

notnamespace=namespace name

Example 1:

<DPL>
notnamespace=Wikinews
notnamespace=Discussion
</DPL>

This list will output pages that are NEITHER in the Wikinews NOR in the Discussion namespace.

Example 2 (with magic word):

<DPL>
notnamespace=Wikinews
notnamespace={{NAMESPACE}}
</DPL>

This list will output pages that are NEITHER in the Wikinews NOR in the namespace the current page is in.

linksto

Introduced in v0.7.7.

Purpose:

Filters the articles which link to a certain page. Magic words are supported. See Help:Magic_words#Page_names_and_related_info for relevant magic words.

Syntax:

linksto=full page name

Example 1:

<DPL>
category=Poets
linksto=Dublin
</DPL>

This list will output pages that are in category "Poets" and link to the page with title Dublin in the Main namespace.

Example 2 (with magic word):

<DPL>
category=Poets
linksto={{FULLPAGENAME}}
</DPL>

This list will output pages that are in category "Poets" and link to the current page, whatever it is.

shownamespace

Purpose:

To restrict the appearance of the namespace name of a page before the page. For example, when this parameter is used, instead of Template:Stub the listing would simply be Stub.

Example:

shownamespace=false

If omitted, the default is true.

Example:

<DPL>
category=Africa
namespace=Talk
shownamespace=false
</DPL>

This list will output all Talk pages in [[Category:Africa]], listed without the Talk: prepended to page names.

mode

Purpose:

To control the output of the DPL.

Syntax:

mode=modename

modename can be one of:

  • unordered — outputs an unordered list — HTML tag "ul" — (default)
  • ordered — outputs an ordered list — HTML tag "ol"
  • none — outputs a list using newlines and HTML tags "br" to separate each item
  • inline — outputs a list using symbol defined by the inlinetext parameter to separate items. See inlinetext for more info.
  • category — outputs resulting articles in a way category-pages are shown (you have to use ordermethod=title|category,title|user,title with this option!)

Example:

<DPL>
category=Africa
mode=ordered
</DPL>

This list will output pages that have [[Category:Africa]] shown in an <ol>...</ol> list.

Related extension variable(s): $wgDPL2CategoryStyleListCutoff.

inlinetext

This replaced 'inlinesymbol'.

Purpose:

To define the inline text used in mode=inline.

Syntax:

inlinetext=wikitext, with wikitext some wiki text, default is '&nbsp;-&nbsp;'.

Extra whitespaces are stripped by DPL from the beginning and end of wikitext. If you want to show one or multiple spaces, use one or multiple '&nbsp;', or use 'nowiki' tags like in '<nowiki> - </nowiki>' which has same effect as '&nbsp;-&nbsp;'.

Example:

<DPL>
category=Africa
mode=inline
inlinetext=&nbsp;&bull;&nbsp;
</DPL>

This list will output pages that have [[Category:Africa]] shown like Item1 • Item2 • Item3 • ...

headingmode

Purpose:

To control the output of the headings in a DPL with complex/multi-parameter ordermethods. (No effect with single-param ordermethods.) For ordermethod=method1,method2,..., method1 is used for headings. E.g. headingmode affects category headings in ordermethod=category,title (2-param ordermethod).

Syntax:

headingmode=modename

modename can be one of:

  • none — headings are not displayed, no heading — (default)
  • unordered — outputs an unordered list — HTML tag "ul"
  • ordered — outputs an ordered list — HTML tag "ol"
  • definition — outputs a definition list — HTML tag "dl"
  • H2 — outputs sections — HTML tags "H2"
  • H3 — outputs sections — HTML tags "H3"
  • H4 — outputs sections — HTML tags "H4"

Example:

<DPL>
category=Africa|Europe
ordermethod=category,title
headingmode=definition
mode=ordered
</DPL>

This list will output pages that belong to one of the categories Africa, Europe in a list similar to this (HTML source), with Pages 1 and 2 in the Africa category, Page 1 in the Europe category as well (in fact, the titles are replaced with the appropriate links):

<dl>
  <dt>Africa</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Europe</dt>
  <dd>
    <ol>
      <li>Page1</li>
    </ol>
  </dd>
</dl>

titlemaxlength

Purpose:

To limit the number of characters of the title to display. If the page title (this does not include the namespace or any other prefix before the title) is bigger than the titlemaxlength value, the title is truncated and ended by '...'.

Syntax:

Same syntax as the count parameter.

order

Purpose:

Controls the sort direction of the list.

Example:

order=orderdirection

orderdirection can be one of:

  • descending — outputs list from most recent to least recent — (default)
  • ascending — outputs list from least recent to most recent

Example:

<DPL>
category=Africa
order=ascending
</DPL>

This list will output pages that have [[Category:Africa]] shown ordered from oldest to newest.

count

Purpose:

Controls the number of results that are shown.

Syntax:

count=n, with n a positive integer

A blank value (count=) for unlimited. It is unlimited by default, depending on extension variables: $wgDPL2MaxResultCount, $wgDPL2AllowUnlimitedResults.

Example:

<DPL>
category=Africa
ordermethod=pagetouched
count=2
</DPL>

This list will output the two pages most recently changed that have [[Category:Africa]].

ordermethod

Purpose:

Determines what criterium (resp. criteria) is (resp. are) used to order the list.

Syntax:

ordermethod=method1,method2,... means ordered by method1 first, then by method2, etc. (like the ORDER clause in SQL)

methodN can be one of:

  • categoryadd — outputs list based on most recent addition to the first category (requires to include one category and one only using 'category' parameter)
  • firstedit — outputs list based on first edit to the pages (creation)
  • lastedit — outputs list based on most recent edit to the pages
  • pagetouched — outputs list based on 'page_touched' timestamp. Read comment on page_touched field in Page_table to see the difference from most recent edit by an author.
  • title — outputs list sorted by article (prefix +) title — (default)

Multi-param ordermethods (see also headingmode option):

  • category,firstedit — outputs list sorted by category, then by first edit
  • category,lastedit — outputs list sorted by category, then by last edit within a category
  • category,pagetouched — outputs list sorted by category, then by pagetouched
  • category,title — outputs list sorted by category, then by title
Replaced by category,sortkey in v0.7.7 to customize the order with sortkeys from category tags, like in MediaWiki category pages.
  • user,firstedit — outputs list sorted by user, then by firstedit by the user
  • user,lastedit — outputs list sorted by user, then by lastedit by the user

Example:

<DPL>
category=Africa
ordermethod=lastedit
</DPL>

This list will output pages that have [[Category:Africa]] showing most recently edited articles at the top.

debug

Purpose:

Sets debugging level.

Syntax:

debug=n, where n is one of:

  • 0 — silent mode, shows nothing
  • 1 — quiet mode, shows (fatal) errors
  • 2 — default mode, like 1 + shows warnings; — (default)
  • 3 — verbose mode, like 2 + shows SQL query.

If you use debug param but not in first position in the DPL element, the new debug settings are not applied before all previous parameters have been parsed and checked. This will generate a warning for debug=2 and above.

Example:

<DPL>
namespace=Media
debug=0
namespace=Special
</DPL>

This list will output the error for the first namespace: Media is not a valid namespace value (pseudo-namespace). Assuming you haven't changed the default debug value (2), you will also get a warning: debug=1 is not input first (before namespace=Media). So it did not apply to namespace=Media but only to what's after. Indeed, you won't get the warning for the second namespace (Special) since debug=0 changed debug settings to silent mode.

DPL debug messages are translatable in DynamicPageList2.i18n.php. See also DynamicPageList2#Internationalization.

minoredits

Purpose:

Controls the inclusion or exlusion of minor edits in lists.

Requires: ordermethod=[...]firstedit|lastedit

Example:

minoredits=criteria

criteria can be one of:

  • exclude — ignore minor edits when sorting lists
  • include — includes minor edits to sort lists — (default)

Example:

<DPL>
category=Africa
ordermethod=lastedit
minoredits=exclude
</DPL>

This list will order pages tagged with [[Category:Africa]] by lastedit, but minor edits will be ignored in the ordering.

redirects

Purpose:

Controls the inclusion or exlusion of redirect pages in lists.

Example:

redirects=criteria

criteria can be one of:

  • exclude — excludes redirect pages from lists — (default)
  • include — allows redirect pages to appear in lists
  • only — lists only redirect pages in lists


Example:

<DPL>
category=Africa
redirects=include
</DPL>

This list will content pages and redirect pages tagged with [[Category:Africa]].

addfirstcategorydate

Requires to include one and one category only, with 'category' parameter.

Conflicts with other "add*date" (addeditdate, etc.) parameters to avoid confusion.

Purpose:

Shows the date/time the article got added to the first listed include category.

Example:

addfirstcategorydate=true

If omitted, the default is false.

Example:

<DPL>
category=Africa
addfirstcategorydate=true
</DPL>

This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the time and date (formatted according to your local mediawiki date display preferences or the user preferences if user logged in).

addeditdate

Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit. ([...,] means complex ordermethods with extra param before firstedit|lastedit are allowed.)

Conflicts with other "add*date" (addpagetoucheddate, etc.) parameters.

Purpose:

If firstedit (resp. lastedit), 'addeditdate=true' shows the date of the first revision/creation (resp. last revision) of the page.

Example:

addeditdate=true

If omitted, the default is false.

Example:

<DPL>
category=Africa
ordermethod=lastedit
addeditdate=true
</DPL>

This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the date of last revision (formatted according to your local mediawiki date display preferences or the user's preferences if logged in).

addpagetoucheddate

Requires ordermethod=[...,]pagetouched or ordermethod=[...,]title. ([...,] means complex ordermethods with extra param before are allowed.)

Purpose:

Shows date/time of last change to the page according to the definition of the 'page_touched' field on Page_table.

Example:

addpagetoucheddate=true

If omitted, the default is false.

Example:

<DPL>
category=Africa
ordermethod=pagetouched
addpagetoucheddate=true
</DPL>

This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the date of last change (formatted according to your local mediawiki date display preferences or the user's preferences if logged in).

adduser

Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit. ([...,] means complex ordermethods with extra param.)

Purpose:

If firstedit (resp. lastedit), 'adduser=true' shows the date of the the first revision/creation (resp. last revision) of the page.

Example:

adduser=true

If omitted, the default is false.

Example:

<DPL>
category=Africa
ordermethod=lastedit
adduser=true
</DPL>

This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the author of the last revision.

listattr

Purpose: Adds attributes to HTML list elements, depending on 'mode' (html element is 'ol' for ordered, 'ul' for unordered, 'div' for others). Can be used with pseudo 'mode=inline' where 'inlinetext' contains one or more <BR/>.

Not applicable to 'mode=category' or mode='inline' (with no <BR/> in inlinetext).

Syntax: listattr= attribute1="val1" attribute2="val2" ...

Examples:

Input (HTML) Output
<DPL>
ordermethod=category,title
headingmode=ordered
mode=none
listattr= class="submenul"
itemattr= class="submenuli" style="font-style: italic;"
</DPL>
<ol>
  <li> Cat1 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
      <span class="submenuli" style="font-style: italic;"> Page1_2 </span>
    </div>
  </li>
  <li> Cat2 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/> 
      <span class="submenuli" style="font-style: italic;"> Page2_2 </span>
    </div>
  </li>
</ol>
<DPL>
ordermethod=category,title
headingmode=ordered
mode=unordered
listattr= class="submenul"
itemattr= class="submenuli" style="font-weight: bold;"
</DPL>
<ol>
  <li> Cat1 (link)
    <ul class="submenul">
      <li class="submenuli" style="font-weight: bold;"> Page1_1 </li> 
      <li class="submenuli" style="font-weight: bold;"> Page1_2 </li>
    </ul>
  </li>
  <li> Cat2 (link)
    <ul class="submenul">
      <li class="submenuli" style="font-weight: bold;"> Page2_1 </li> 
      <li class="submenuli" style="font-weight: bold;"> Page2_2 </li>
    </ul>
  </li>
</ol>

itemattr

Purpose: Adds attributes to HTML list items, depending on 'mode' (element is 'li' for ordered/unordered, 'span' for others).

Not applicable to 'mode=category'.

Syntax: itemattr= attribute1="val1" attribute2="val2" ...

Example: see listitemattr.

hlistattr

Purpose: Adds attributes to the HTML list element at the heading/top level, depending on 'headingmode' (HTML element would be 'ol' for ordered, 'ul' for unordered, 'dl' for definition, 'div' for others)

Not yet applicable to 'headingmode=none'.

Syntax: hlistattr= attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output
<DPL>
ordermethod=category,pagetouched
headingmode=H2
mode=ordered
hlistattr= class="topmenul" id="dmenu"
</DPL>
<div class="topmenul" id="dynamicmenu">
  <H2> Category 1 (link) </H2>
  <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
  </ol>
  <H2> Category 2 (link) </H2>
  <ol>
      <li>Page2_1</li>
  </ol>
</div>

See also hitemattr.

hitemattr

Purpose: Adds attributes to HTML list items (headings) at the heading level, depending on 'headingmode' (HTML element would be 'li' for ordered/unordered, 'div' for others).

To be used with headingmode='unordered' or 'ordered'. (Not yet applicable for others.)

Syntax: hitemattr= attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output
<DPL>
ordermethod=category,title
headingmode=unordered
mode=ordered
hlistattr= class="topmenul" id="dmenu"
hitemattr= class="topmenuli" style="color: red;"
</DPL>
<ul class="topmenul" id="dmenu">
  <li class="topmenuli" style="color: red;"> Category 1 (link)
    <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
    </ol>
  </li>
  <li class="topmenuli" style="color: red;"> Category 2 (link)
    <ol>
      <li>Page2_1</li>
    </ol>
  </li>
</ul>

Server-Wide Configuration

Extension options

You can set the following global variables, preferably in your LocalSettings.php (after including DynamicPageList2.php) or in DynamicPageList2.php directly, to configure and restrict the usage of the DPL extension server-wide.

$wgDPL2MaxCategoryCount Maximum number of categories specified in a DPL with 'category' or 'notcategory' parameters = Maximum number of categories allowed in the SQL-query. To prevent too complex queries.

$wgDPL2AllowUnlimitedCategories Allows unlimited categories in the query. ($wgDPLMaxCategoryCount will be ignored)

$wgDPL2MinCategoryCount Minimum number of categories specified in a DPL with 'category' or 'notcategory' parameters = Minimum number of categories needed in the SQL-query for setting limits. To prevent output of a gigantic list.

$wgDPL2MaxResultCount Maximum number of results to allow.

$wgDPL2AllowUnlimitedResults Allow unlimited results to be shown. ($wgDPLMaxResultCount will be ignored)

$wgDPL2CategoryStyleListCutoff Max length to format a list of articles chunked by letter as bullet list, if list bigger, columnar format user (same as cutoff arg for CategoryPage::formatList()). Used by mode=category.

$wgDPL2Options Gives control on the extension parameters (see Usage of DynamicPageList2 for the list). The best way to get familiar with it is to look at its declaration in DynamicPageList2.php (beginning). Use it at your own risk. Anyway, below are some usage examples:

  • Change default parameter values: $wgDPL2Options['param']['default']='val'. Make sure val is a valid param value.
Example: $wgDPL2Options['shownamespace']['default']='false' to change the shownamespace default value to 'false'.
  • Restrict parameter options: if the parameter param has options option0, ... , optionN (according to the definition of $wgDPL2Options in DynamicPageList2.php), $wgDPL2Options['param'] = array('option0',...,'optionn-1','optionn+1',...,'optionN') will disable optionn for users (not allowed). If you disable an option currently defined as default parameter value, make sure you change the default value to another option as well (see previous item).

Internationalization

Since MediaWiki 1.7.1, extension messages are translatable (more info). To use this feature and translate the DPL messages into your favorite language, have a look at DynamicPageList2.i18n.php. All you have to do is to create in this file a $wgDPL2Messages['lang'] array where 'lang' is your language code, and use $wgDPL2Messages['en'] as a model. Replace values with appropriate translations.


ToDo

See Talk:DynamicPageList2#General_ToDo_list.


Improvements and Changes

Hack v0.7.7

Features:

  • Linksto parameter
  • Filtering on category headings (headingmode)
  • Shows time and date (only date before this version)
  • Support for magic words with (not)namespace and linksto parameters
  • ordermethod=category,sortkey replaces 'category,title' and uses sortkeys from category tags to customize the order.

Other(s):

  • No more warning when filters like 'namespace' or 'category' (or linksto) are not used.

Hack v0.7.1

Bugfix: bug 7361.

Hack v0.7.0

Feature(s):

  • Can use 'category' param on the Uncategorized pages like a normal category.

Hack v0.6.4

Feature(s):

Hack v0.6.3

Features:

Bugfix:

Others:

  • 'null' headingmode renamed to 'none' like for 'mode' param

Hack v0.6.2

Features:

  • New parameters to add attributes to DPL-generated HTML elements: 'hitemattr' (to input attributes for html list items at the heading level), 'hlistattr' (same for the top html list element), 'itemattr' (same for sublist items or list items if no heading), 'listattr' (same for sublists or lists if no heading)
  • Added newline chars at appropriate places to make the HTML output more human readable

Hack v0.6.1

Features:

  • Replaced 'inlinesymbol' parameter with 'inlinetext', more generic: any wiki text can be used as inline text now, default changed to ' - ' (added enclosing spaces).
  • Added warning message if an unknown parameter is used (and gives list of DPL parameters).

Bugfix:

  • A param val can contain '=' (it is not chunked at second '=' if any).

Hack v0.6

Requires MediaWiki 1.7.1.

Features:

  • Internationalization: added DynamicPageList2.i18n.php
  • Complex 'ordermethod' values: 'category,firstedit', 'category,lastedit', 'category,pagetouched', 'category,title', 'user,firstedit', 'user,lastedit'
  • 'categorymode' param replaced by 'headingmode', more general, e.g. not only for category headings but also for user headings (with new ordermethod=user,...), with 'H2', 'H3', 'H4' values replacing 'section', 'subsection', etc. and 'null' for no heading
  • New extension variable to customize options: $wgDPL2Options.
  • 'suppresserrors' param replaced by 'debug'= 0 to 3, with better debugging
  • Improved error handling on parameters/options

Bugfixes:

  • 'namespace' takes texts only (indices not allowed anymore) and pseudo-namespaces (negative indices, e.g. Media, Special) not allowed
  • $wgDPL2Min(Max)CategoryCount takes all specified categories into account.

Others:

  • Allowed DPL with no specified namespace/category.
  • Optimization: uses LinkBatch/LinkCache to make good/bad links
  • More comments in phpDocumentor format

Hack v0.5.1

Feature:

Hack v0.5

Tested on MediaWiki 1.6.7

Features:

  • Added 'categorymode' option for output mode used with 'ordermethod=category' to render category items. Possible list modes: unordered, ordered, definition, section, subsection, etc.

Bugfixes:

Others:

  • Renamed $wgDPL2MaxCategoryShortListResultCount to $wgDPL2CategoryStyleListCutoff.

Hack v0.4

Features:

  • extension credit info (for Special:Version)
  • support for Magic words in category names (with category and notcategory parameters)
  • "ordermethod=category" (sort by category), "ordermethod=firstedit" (by creation date) and "ordermethod=pagetouched" differentiated from "ordermethod=lastedit".
  • "mode=category" can be used with "ordermethod=category"
  • "adduser" (resp. "addeditdate") adds author (resp. revision date) according to ordermethod=firstedit or lastedit

Bugfixes:

  • Fixed bug with 'addfirstcategorydate=true'.
  • Fixed bug: if 'addfirstcategorydate=true' and only one union of categories ('category= Category1|Category2|...), the 'firstcategorydate' was not added.

Hack v0.3.3

Features:

  • possibility to add the date of the last change
  • possibility to customize the symbol which is used for "ordermethod=inline"

Bugfixes:

  • changed default ordermethod to "title" to fix a usabilitybug when ANDing multiple categories.

Hack v0.3.2

Features:

Bugfixes:

  • Eliminated a bug while using constructs like Cat1 AND Cat2

Hack v0.3.1

Bugfixes:

  • Eliminated non-initialized variables
  • works with DB prefixes now

Hack v0.3

New features:

  • Possibility to use "inline" as Outputmode, this creates lists like "Item1 - Item2 - Item3".

Changes:

  • No need for the DPL2UncachedPages Article anymore. Every article using DPL will unset it's cache automatically.

Hack v0.2.1

Bugfixes:

  • Fixed a typo in the code which resulted in wrong queries in some configurations

Hack v0.2

New features:

  • Possibility to use "old" DynamicPageList and DynamicPageList2 at the same time. The tag ist called DPL now

Changes:

  • The tag you must use is <DPL> now
  • The category/namespace separator is '|' now instead of ','.
  • Page for uncached Sites ist DPL2UncachedPages now.

Hack v0.1

New features:

  • combine categories using logical OR and AND:
    category=1st,2nd,3rd
    category=4th,5th
means Articles have to be in (1st OR 2nd OR 3rd category) AND (4th OR 5th category)
  • selecting several namespaces using namespace=1st,2nd,3rd... the result will have to be in namespace 1st OR namespace 2nd ...
  • select articles just by namespace without using any categories
  • sort by pagetitle (ordermethod=title)
  • always invalidate cache on certain specified pages (kind of dirty hack, details: http://bugzilla.wikimedia.org/show_bug.cgi?id=2282)
  • output result categorypage-style (mode=category)
  • removed a bug which made ordermethod=lastedit showing wrong results
  • more logical, structured, beautiful and even smaller code :-)

Changes:

  • removed the option $wgDLPMinResultCount in the code, because it made no sense to me. I don't understand how somebody should use an option 'MinResultCount' (you can delimit many results, but you can't increase results...)
  • suppresserrors=true now only suppresses errors about no results, every other error will be shown
  • If you don't use categories or use more than one category and use the options 'addfirstcategorydate=true' or 'ordermethod=categoryadd' an error message appears.

Note that there could still be bugs in there, though it works perfectly for me at the moment. I would be glad to receive comments or bugreports!