Extension:SubPageList2

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Sub Page List 2

Release status: beta

Implementation Tag
Description Sub Page List 2 is an extension that automaticaly creates a list of the subpages of a page. The dynamic created list will be created automatically on every edit of the page where the SubPageList element is given.
Latest version 1.0 (2006-10-02)
MediaWiki 1.7.1 or above
License No license specified
Download SubPageList2.zip

Translate the SubPageList2 extension if possible

Check usage and version matrix; code metrics

Sub Page List 2 is an extension that automaticaly creates a list of the subpages of a page. The dynamic created list will be created automatically on every edit of the page where the SubPageList element is given.

Source[edit | edit source]

At the moment the source is only available from one mirror:

http://stuff.schaelle.de/SubPageList2/SubPageList2.zip
Note: In order to best display this extension when we go to Special:Version in our wikis, in the code downloaded from above, make the following line:
$wgExtensionCredits['parserhook'][] = array( 'name' => 'Subpage List 2', 'author' => 'Martin Schallnahs, Rob Church' );
look like this (2 additional lines with description and url link):
$wgExtensionCredits['parserhook'][] = array(
   'name' => 'Subpage List 2',
   'version' => '1.0 (2006-10-02)',
   'description' => 'automatically creates a list of the subpages of a page',
   'url' => 'http://www.mediawiki.org/wiki/Extension:SubPageList2',
   'author' => 'Martin Schallnahs, Rob Church' );
And, while we're at it, why not put ALL downloadable source files and text/readme/install and so on in a sub page right here underneath the extension, say, at Extension:SubPageList2/Source or Extension:SubPageList2/Download? Why not do this for anything downloadable at MediaWiki?
Thanks. -- Peter Blaise peterblaise 16:35, 11 July 2007 (UTC)

Installation[edit | edit source]

  • After download the source uncompress the Zip file.
  • Upload SubPageList2.php to your wiki/extension directory.
  • Add the following lines to your LocalSettings.php:
# for SubPageList extension
require_once("extensions/SubPageList2.php");

A good position is at the end of the file, but before the closing delimiter (?>).

History[edit | edit source]

Subpage List 2 is a very extend hack of the orginial SubpageList by Rob Church in autumn 2006.

A request was made to MediaWiki developers to install this extension on Wikiversity in February 2008. The request was turned down due to technical defects in the extension. Following this, there is a new extension under development called Extension:SubPageList3, which is a simplified version. --McCormack 05:46, 17 February 2008 (UTC)

Authors[edit | edit source]

MediaWiki Version[edit | edit source]

  • Successfully tested on MediaWiki 1.7.1
  • Untested on MediaWiki 1.7.0 or less

Usage[edit | edit source]

To generate an automatic Subpage using Subpage List 2 add the following code to a page:

<subpages />

That code will generate a list of all subpages of the current page. To specify the list use the arguments in this syntax:

<subpages arg=value />

or

<subpages arg="value" />

or

<subpages arg='value' />

A good suggestion if you have many arguments is to use this syntax:

<subpages
  arg1=value
  arg2=another_value
/>

But if you need a title with a space you must wrap it using a single or double apostrophe.

Arguments[edit | edit source]

category[edit | edit source]

Category of the pages.

Default:

  • -1

Can be:

  • -1: All categorys
  • text: Title of a category

Code example:

<subpages
  category="News"
/>

At the moment this argument only can have one value!

count[edit | edit source]

Count of articles that shall be displayed. Must be numeric!

Default:

  • -1

Can be:

  • -1: All pages
  • numeric: Number of pages that are displayed

Code example:

<subpages
  count=10
/>

debug[edit | edit source]

Error displaying on or off.

Default:

  • 0

Can be:

  • 0 or false: Show errors
  • 1 or true: Didn't show errors

Code example:

<subpages
  debug=true
/>

or

<subpages
  debug=1
/>

deepness[edit | edit source]

How deep the Subpage List 2 extension get the subpages.

Default:

  • -1

Can be:

  • -1: All pages
  • numeric: Deepness level

Example:

You have Mainpage/Fu/Bar but deepness is 1, then Bar wont be displayed.

Code example:

<subpages
  deepness=1
/>

The above statement is inaccurate (as tested on MW versions 1.9.3+)[edit | edit source]

Entering "deepness=1" it will list all subpages with at least one level of depth; if you put in "deepness=2", it will list only those subpages with at least 2 levels.

Examples

deepness=1[edit | edit source]

On page Mainpage, using the example above (Mainpage/Fu/Bar), and expanding it further (to include Mainpage/Fu/Bar/sub

<subpages
 deepness=1
/>

will return

  • Mainpage/Fu
  • Mainpage/Fu/Bar
  • Mainpage/Fu/Bar/sub

This is not expected behavior (at least from a user's perspective).

From a user's perspective, "deepness=1" should return

  • Mainpage/Fu

ONLY, i.e., those pages with EXACTLY one subpage, not pages with >=1 subpages.

deepness=2[edit | edit source]
<subpages
 deepness=2
/>

will return

  • Mainpage/Fu/Bar
  • Mainpage/Fu/Bar/sub

That is, it does NOT return those pages with =<2 subpages or ==2 subpages (either of which might be expected), rather it returns only those results with >=2 subpages, which is a problem if you are dealing with a particularly hierarchical site where the use of categories would not be appropriate, e.g., a catalog storing books by year, serial publications, or law by title and section number.

Fungiblename 17:16, 20 January 2008 (UTC)

headline[edit | edit source]

Headline size of each title in a preview list.

Default:

  • 2

Can be:

  • numeric: Headline size

Example code:

<subpages
  headline=3
/>

ignore[edit | edit source]

What pages shall be ignore making a Subpage List using Subpage List 2.

Default:

  • -1

Can be:

  • -1: No pages are ignored
  • text: Title of pages seperated by a vertical line (|)

Example code:

<subpages
  ignore=Fubar
/>

or

<subpages
  ignore="Fu|bar|Another_Pagetitle"
/>

order[edit | edit source]

Type of ordering the Subpage List.

Default:

  • ASC

Can be:

  • ASC: ascending - from up to down
  • DESC: descending - from down to up

Example code:

<subpages
  order=DESC
/>

ordermethod[edit | edit source]

Using what the list shall be ordered.

Default:

  • title

Can be:

  • title: Alphabetic order by the page title
  • lastedit: Timestamp numeric order of the last edit of the page

Example code:

<subpages
  ordermethod=lastedit
/>

mode[edit | edit source]

Output style of the list.

Default:

  • ordered

Can be:

  • unordered: UL list as output
  • ordered: OL list as output
  • preview: Listing of the pages with headline and a preview in a specific output format - See previewcount and previewmode

Example Code:

<subpages
  mode=preview
/>

namespace[edit | edit source]

Namespace of the pages.

Default:

  • -1

Can be:

  • -1: All namespaces
  • text: Title of a category

Code example:

<subpages
  namespace=Help
/>

At the moment this argument only can have one value!


parent[edit | edit source]

Parent of the listed pages.

E.g. if you are in Mainpage it will list all subpages of Mainpage. If you are in Mainpage but you use News the list generate a Subpage List of alle subpages of News.

Default:

  • -1

Can be:

  • -1: The current page title
  • text: Title of the specific page

Code example:

<subpages
  parent=News
/>

At the moment this argument only can have one value!

previewcount[edit | edit source]

How much letters are shown in a preview list.

Default:

  • -1

Can be:

  • -1: The whole content of the page
  • numeric: Numeric letters of a page following by three dots
  • firstsection: The first section/part of a page (in the most times the introduction)

Code example:

<subpages
  previewcount=100
/>

or

<subpages
  previewcount=firstsection
/>

previewmode[edit | edit source]

Style of the preview list.

Default:

  • normal

Can be:

  • normal: Normal layout
  • pre: A tab before every line (using colons)
  • tt: In the teletyper layout
  • code: Wrapped by a code unit

Code example:

<subpages
  previewmode=pre
/>

showpath[edit | edit source]

Style of the title of page that is displayed in the list.

Default:

  • normal

Can be:

  • normal: Normal, e.g. Mainpage/Entry/Sub
  • notparent: The path without the $parent item, e.g. Entry/Sub
  • no: No path, only the page title, e.g. Sub

Examples[edit | edit source]

Now follow some examples:

Latest $x Whatever[edit | edit source]

<subpages
  parent=News
  order=DESC
  order=lastedit
  ignore=2006
  mode=ordered
  showpath=no
  count=4
/>

Generates the following output:

  1. Latest News
  2. News
  3. Yet Another News
  4. News again
  5. 5th News

Latest $x Whatever with preview[edit | edit source]

<subpages
  parent=News/2006
  order=DESC
  order=lastedit
  ignore=2006
  mode=preview
  previewcount=firstsection
  previewmode=pre
  showpath=no
  headline=4
  count=1
/>

Generates:

Latest News[edit | edit source]

Thats the first section of the latest news.
Can be multi lined.

See also[edit | edit source]

Wikis using Sub Page List 2[edit | edit source]

If you use this extension, please add your website here.