Page with examples

NewsZ Mediawiki extension


Warning: although several sanitizer features was added to code, this extension is not yet tested in public writable wikis.

What can this extension do?

Allows users to create frames and tables with lists of News per Category, limited to n elements. With thumbnails preview!

This extension search the first tag "Image:" in article and uses it as thumbnails preview; if the article not contains images, then uses a default "Logo-category_name.png" as thumbnail.

You can chose several types of previews: simple text, icons in colums, icons with text preview.

NEW: from version 0.9 text preview is extracted from first valid text block (a paragraph) of article. But you can also use the hidden tags as is explained below.

To mark the text inside article for preview, simply use this syntax:

<!--NewsZ--> ... here the text article preview ... <!--EndZ-->

You can hide a preview text in article:

<!--NewsZ ... here the hidden text for article preview ... EndZ-->

You can also hide a icon preview in every article:

<!-- [[Image:my_hidden_logo.png]] -->


{{#newsz:My_news_category|begin from|news counter|cols or chars| class="" style="" ...}}


"My_news_category" = a Category (Note: better replace spaces with underscore)
"begin from" = 0-->last inserted, 1-->previous, etc.
"news counter" = number of articles in table
"cols or chars" = 0 --> list article without thumbnails
                1 to 15 (-1 to -15) --> n. of cols in preview per table
                >15 (or >abs(-15))  --> number of char in text article preview
                negative numbers    --> returns a table with date and article preview
last field accepts list of styles


{{#newsz:World_news|0|10|140| style="font-size:14px; width:50%;"}}

Download instructions

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

or direct download tar.gz:

File:NewsZ-1.0.tar.gz - NewsZ Mediawiki extension v.1.0 (latest) - MD5SUM: 350103ad985f2b2865cbbc9e6f093dc5
File:NewsZ-0.9.tar.gz - NewsZ Mediawiki extension v.0.9 - MD5SUM: 9ef98761b0d48513156a84826357e1cf
File:NewsZ-0.8.3.tar.gz - NewsZ Mediawiki extension v.0.8.3 - MD5SUM: 7aabe9790525692e16c521185e3aae28

(you must extract tar.gz to your wiki extensions/ folder)


To install this extension, add the following to LocalSettings.php:

require_once( "$IP/extensions/NewsZ/NewsZ.php");
//Add global custom thumbnail size here (default size is "96x72px"):
//To avoid search articles in first level subcategories add this line:
$wgNewszNotSubCategory = true;
//Date format: default=english(MDY); DMY=latin; YMD=scientific
$wgNewszFormatDate = 'YMD';

Speed up the news refresh

Mediawiki makes intensive use of server-side cache. To speed up news refresh you can invalidate cache in Localsettings.php:

//$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
$wgCacheEpoch = gmdate( 'YmdHis' );


This extension is publied at Mediawiki: and at GitHub

Retrieved from ""