Extension:EmbedNews

What can this extension do?
Embed News allows the most current news to be displayed. A page is created to contain all the news that is to be displayed and on which dates it is to be displayed on. The extensions tag is placed on the page you wish the most current news to be displayed on. The extension will search the page for most current news it can find and display it on the page. This is helpful if you have a lot of news of future events but only want visitors to see the current event.

A Calendar can be displayed on the side to show events. Links are provided to events and highlighted. The calendar has been updated to display a window of dates, so the current week is in the middle, and the previous and next 2 weeks are displayed. This allows people to see events in the next month which where not displayed in the original implementation.


 * You can have news for any day.
 * Only the event happening today or about to happen is displayed.
 * Events must be in order of happening.
 * Titles are picked up as well, not just subheadings
 * Empty sections are ignored
 * Calendar to display a current events happening
 * News can be displayed in tabular form
 * Backlogging to show past events
 * Can show a set number of past events and/or up to certain amount of days ago.

Need help or request features, edit my discussion page.

Usage
To start displaying news on the page:

__NOCACHE__ news

Where news inside the tags is the news page. If the page does not exist yet, the extension will provide a link to create the page.

The news page is structured with the date as the title and the news for that date is written below. Example below

23 November 2007
Longer dates work

2007-11-15
Short dates are picked up

2007-11-10
Wiki links work as well

=2007-11-15=

titles work fine

= 2008-01-08 =

Titles and sub headings work as well

Quite a few date representations can be detected by the extension.

For the regex minded person the following is used to find dates in a wiki page:

/[=]*=[\[]*([^\]\n=\"]*)[\]]*=*=/

News Table
You can display news in a table.

__NOCACHE__ past five events and up to 14 days ago: news|table backlog=5 daystail=14 past five events: news|table backlog=5 past 14 days: news|table daystail=14

The | character is used to insert attributes where the wiki page is entered first then pipe then the attributes.

The table attribute tells the extension to display news in a table formatted as |date|event|.

The backlog attribute tells how many events to display.

The daystail attribute tells will only show news in the previous amount of days.

A daysahead attribute can be used similarly to days tail to set the current day 'n' number of days if you wish to see more future events.

The event column is designed to only show an excerpt of the text. If only a excerpt is shown, a ... is added to the end of the line. Also unfinished words are removed. This may have trouble displaying embedded templates, do not use table view if embedding templates.

Table styling can be applied by using the style and border param. For example:

news|backlog=3 table style="width:90%;color:green;" border=1

The | symbol splits the wiki page to the parameters.

Example Wiki
See the extension working... Current News Shown News page ( 404 errors )

Download instructions
I have provided the sources in a zip and tar file.

Unpack the files with the appropriate command. $ tar -xjvf embednews.tar.bz2 $ unzip embednews.zip

The following files will be unpacked:


 * CHANGELOG Changes that I have made, read before installing
 * COPYING GNU License
 * MonoBook.php Patched MonoBook file
 * README Installation and usage documentation
 * embednews.css Calendar Styling file
 * embednews.php Main extension

Installation
To install you need to place the following files into the following locations. From mediawiki root directory. $ cp embednews.php extensions/ $ mkdir skins/embednews/ $ cp embednews.css skins/embednews/

To your LocalSettings.php file append the following:

Where $embednewsfeed is optional if you wish to see the calendar explained below.

Calendar Install
To install the calendar you need to make a patch to your skin. Currently Monobook for version 1.11.0 is provided. Replace your old version with this new version and make a backup of the original.

$ cp -b MonoBook.php skins/MonoBook.php

Or you can make a manual patch by inserting the following lines into your skin files where you wish the calendar to be displayed.

This will create a new portlet.

Once installed set $embednewsfeed in your LocalSettings to the name of the page containing your news.

Required Extensions
You will need magic no cache extension provided here to allow the page to be updated automatically.

http://www.mediawiki.org/wiki/Extension:MagicNoCache

This extension has been tested to work on mediawiki 1.11.0 with little changes

Customization
A css file for the calendar styling is provided. The calendar html code is found within the extension file.

Feature Requests

 * Embedding events from multiple pages (see discussion)
 * Half implemented.
 * Allow multiple news feeds
 * Allow calendar to be added without touching Local Settings file
 * Make it easier for people to set up calendar when they have no access to the local settings file.
 * BUG Backlogging in default view has a glitch when reaching end of the news page