Extension:News

The News extension allows a custom excerpt from Special:Recentchanges to be included on a wiki page, or to be published as an RSS or Atom feed. It supports several types of filtering as well as full custom formating of entries, using template syntax.

Note that the functionality of this extension overlaps with the DynamicPageList and DynamicPageList2 extensions - however, this extension has a different focus.

Installing
Copy the News directory into the extensions folder of your MediaWiki installation. Then add the following line to your LocalSettings.php file (near the end):

require_once( "$IP/extensions/News/News.php" );

Usage

 * &lt;news&gt;: this includes a list of recent changes on the wiki page
 * &lt;newsfeed&gt;: this defines a news feed of recent changes; on the wiki page, a preview is rendered, similar to the output of the tag; the wiki page then also supports the newsfeed action, which returns the feed in RSS or Atom format.
 * &lt;newsfeedlink&gt;: this creates a link to a news feed defined using a tag. This is convenient for creating prominent links to the news feeds.

Filtering and formatting
To get the last 10 changes to your wiki on any wiki page, use the following:

You can provide options to controll the listing (for example, 20 entries and no minor edits):

To define your own format for the generated list, you can provide a pattern that will be used for each entry:

* (User:, )

For a full list of options and template parameters, see  below.

The &lt;newsfeed&gt; tag supports the same optiosn for filtering and formatting as the &lt;news&gt; tag. For information on how to access a feed defined using &lt;newsfeed&gt;, see the section  below.

Options
The following options (tag attributes) can be used to controll the output of the &lt;news&gt; tags:


 * unique: show only the most recent change to each page
 * limit: the maximum number of entries to show
 * categories: limit results to the given categories. Multiple categories can be given separated by "|"; Intersections of categories are not                supported. Recursion into subcategories is not supported.
 * namespaces: limit results to the given namespaces. Multiple namespaces can be given separated by "|"; you can use "0", "-" or "main" to refer to the default namespace.
 * notalk: ignore all "talk" namespaces. Not used if the namespaces option is given.
 * nominor: hide minor edits ("true" or "false", default is "false"). *
 * nobot: hide bot edits ("true" or "false", default is "false"). *
 * noanon: hide anonymous edits ("true" or "false", default is "false"). *
 * onlypatrolled: show only patrolled edits ("true" or "false", default is "false"). *
 * onlynew: show only page creations ("true" or "false", default is "false"). *
 * prefix: wikitext to be inserted before the wikitext generated from the template text is parsed. Can be used to make tables from news.
 * postfix: wikitext to be inserted after the wikitext generated from the template text is parsed. Can be used to make tables from news.

'' * if some edits are filtered out, the edit shown by in the news list may not refer to the current revision. To avoid people clicking the link and seeing a later, possible undesiarable version, use   in your custom pattern to link to the exact revision. See the "parameters" section below.''

Parameters
When giving a template text between the &lt;news&gt; tags, the following template-parameters are available (use them as ):


 * rawtime: raw timestamp - can be formated using the parser function "time", e.g.
 * date: date of the edit, formated per user preference
 * time: time of the edit, formated per user preference
 * timeanddate: time and date of the edit, formated per user preference
 * namespace: numeric namespace id, can be used with
 * title: canonical title (without namespace prefix)
 * pagename: full title, with namespace prefix
 * type: numerical change type (0 = edit, 1 = new, 2 = move, 3 = log, 4 = move-over)
 * minor: "true" for minor changes, blank otherwise
 * user: user name who made the entry
 * comment: edit summary (escaped wikitext, safe to use)
 * new_rev: revision id associated with this entry (or zero)
 * old_rev: revision id associated with the entry before this one (or zero)
 * diff: full diff link for the edit (or blank)
 * permalink: full url to the revision created by the edit (may not be the current revision)
 * bot: "true" for bot edits, blank otherwise
 * new: "true" for newly created pages, blank otherwise
 * patrolled: "true" if the edit was patrolled, blank otherwise
 * old_len: page length before the edit
 * new_len: page length after the edit
 * content: the full content of the page
 * head: the page's content up to about 2KB of text, with smart cut-off.

Accessing Feeds
If the page Foo defines a feed using a &lt;newsfeed&gt; tag, that feed can be referenced by using feed=rss or feed=atom in the url respectively.

So, if the URL path for page Foo is /wiki/Foo, you can use /wiki/Foo?feed=rss to get an RSS feed for that page. If the URL is /w/index.php?title=Foo, you would use /w/index.php?title=Foo&feed=rss

You can conveniently create links to feeds using the &lt;newsfeedlink&gt; tag: For example, &lt;newsfeedlink feed="Foo" format="rss"&gt;My Foo Feed&lt;/newsfeedlink&gt; would generate a link to the news feed defined on page Foo using a &lt;newsfeed&gt; tag.

You can also specify an icon to use in the link: &lt;newsfeedlink feed="Foo" format="rss" icon="rss.png"&gt;My Foo Feed&lt;/newsfeedlink&gt; would generate a link that has the image "rss.png" before the link text (the icon option refers to the name of an image uploaded to the wiki). &lt;newsfeedlink feed="Foo" format="rss" icon="rss.png|right"&gt;My Foo Feed&lt;/newsfeedlink&gt; would generate a link that has the image to the right of the link text; and &lt;newsfeedlink feed="Foo" format="rss" icon="rss.png" title="RSS feed"/&gt; generates a link that only shows the given icon. The title attribute specifies the tooltip to show when the mouse hovers over the link.

Note that the link text may contain full wiki text, and the title-attribute may contain variables like.

Configuration
Configuration settings to define in LocalSettings.php

$wgNewsFeedURLPattern = $wgArticlePath. '?feed=$2'; (note that $wgArticlePath already contains $1 withe the meaning "page title") If you want to use rewrite rules for canonical feed URLs, like /feed/Foo.rss, set $wgNewsFeedURLPattern = '/feed/$1.$2';
 * $wgNewsFeedURLPattern: this defines the pattern used by the &lt;newsfeedlink&gt; tag to generate feed URLs. In the pattern, $1 will be replaced by the page title, and $2 will be replaced by the requested feed format. If you are using pretty URLs with $wgArticlePath set to $wgScript/$1 or /wiki/$1, etc, you can use the following for nicer feed URLs:

$wgNewsFeedUserPattern = '$1@'. $wgServerName;
 * $wgNewsFeedUserPattern: this defines the pattern used to generate author names in feed items. In the pattern, $1 is replaced by the user name. To e.g. generate email-addresses at your site as author names, use

Related Extensions
The Dynamic Page List extension creates reports on pages based on a variety of selection criteria and offers mechanisms for content transclusion.