Extension:NewsBulletins

What can this extension do?
This extension adds the ability to create a news/bulletins block on a wiki page. This can be useful to easily update users on what's going on around the wiki by adding items with a category addition, rather than static page editing.

Usage
This extension is used to create a block that displays new/bulletins for a site. This will be really helpful for categorizing quick bulletins and having them automatically added the block on the frontpage or a page with heavy traffic. One can add a block anywhere using the following tag:  To add articles to the news/bulletins, add the category "Bulletins" to an article and it will be added to the display. There are many options for customizing that are listed below.

Download instructions
Please cut and paste the code found below and place it in: $IP/extensions/NewsBulletins/NewsBulletins.php Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: To add the custom css (display parameters), edit the page MediaWiki:Common.css by adding the following lines:

Configuration parameters
There are many options available through this extension. Please report any issues or requested options. Options are added within the  tag like the following: Wiki text. option=value|anotheroption=differentvalue Wiki text. NOTE: Only add options if you are changing values from the default. Adding an option with the default value will not cause problems, but it is redundant and will be dropped. The following options are available to use:
 * category
 * Default: "Bulletins"
 * This is the category that the extension will use to find your news/bulletins. Add this category to pages to have them picked up by this extension.


 * header
 * Default: null
 * Providing a header will give the block a header (title, banner) that is the text supplied.


 * links
 * Default: true
 * Changing links to 'false' or 'off' will turn the title links off of each entry.


 * limit
 * Default: 5
 * Tunes the number of pages that are returned to the block. Value [1,99] (Thats between 1 and 99).


 * order
 * Default: DESC
 * Changing order to 'asc' or 'flip' will reverse the sort order of the pages to oldest first.


 * timestamp
 * Default: true
 * Changing timestamp to 'false' or 'off' will hide the timestamp that appears after every page item.

Using Teasers
If you desire to have the news/bulletin block only display teasers rather than the full article without losing the entire article text use the following feature. Add the tag to your page with the desired teaser text to have this extension use this text rather than the full article text. When viewing the article, the teaser text will not be visible. Example page using the tag function: Interested in this article? Main article text to be displayed on the page. The resulting page will not show the teaser text, but will show the main article text. This extension will use the text provided within the tag as its text. If no tag is found, the extension will use the full page text as its teaser, so this option is NOT required.

Using Titles
If you desire to have the news/bulletin block display a specific title instead of the articlename of the news bulletin.Add the tag to your page with the desired title text to have this extension use this text rather than the articlename of the news bulletin. When viewing the article, the title text will not be visible. Example page using the tag function: My first news! Interested in this article? Main article text to be displayed on the page. The resulting page will not show the title text, but will show the main article text. This extension will use the text provided within the tag as its text. If no tag is found, the extension will use the articlename of the news bulletin as its teaser, so this option is NOT required.

Examples
Get a basic news/bulletins block using the category 'Bulletins':  Get a block with limit 10 using category 'PressEvents': category=PressEvents|limit=10 Get a block with no link, no timestamps, and in reverse order using the category 'Bulletins' and header 'News - ': header=News - |links=off|timestamp=false|order=flip

Code
Please cut and paste the code found below and place it in: $IP/extensions/NewsBulletins/NewsBulletins.php Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Thanks
A special thanks to Barrylb and the Calendar extension, http://www.mediawiki.org/wiki/Extension:Calendar_%28Barrylb%29, for inspiration and lots of coding help. This extension not possible without code from the calendar extension.

Version 1.1

 * Added a " " tag, allowing to display a custom title for a news item instead of the articlename.
 * Added the time zones improvements which were given in the talk page.
 * Added a "$messages" property to the "newsBulletins" class, which contains internationalisation data. This adds the following features:
 * Translated versions of the "No entries found at this time!" message.
 * Local translations of the default category newsBulletins is relying on.
 * Modified the code so that translated versions of the "category" wiki tag could be correctly hidden.