Extension:NewsZ

Warning
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. New version 0.8.x browse the subcategories and may be a true "news aggregator", now.

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

To mark the text inside article for preview, simply use this syntax: &lt;!--NewsZ--&gt; ... here the text article preview ... &lt;!--EndZ--&gt;

You can hide a preview text in article: &lt;!--NewsZ ... here the hidden text for article preview ... EndZ--&gt;

You can also hide a icon preview in every article: &lt;!-- --&gt;

Usage
where: "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 --> n. of cols in preview per table >15 --> number of char in text article preview last field accepts list of styles

example:

Download instructions
Please cut and paste the code found below and place it in. 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:

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:

Code
Paste the code below in extensions/NewsZ/NewsZ.php: ';

$output='';

$thumbsize='96x72px'; if ($wgNewsZthumbsize != null) $thumbsize=$wgNewsZthumbsize;

$newscounter = $newscols;

$categories = "cl_to=". $dbr->addQuotes($category);

if ($wgNewszNotSubCategory == null) { //Add subcategories to 'cl_to=...' WHERE string $title = Title::newFromText($category); $links = getCategoryLinks($dbr, $title, 0);

foreach ($links as $l) { // Make a Title for this item $title = Title::makeTitle($l->page_namespace, $l->page_title);

if ($title->getNamespace == NS_CATEGORY) $categories .= " OR cl_to=". $dbr->addQuotes($l->page_title); }	}

fzGetArticles ($dbr, $res, $categories, $firstpage, $countpages);

if ($dbr->numRows($res) <= 0) return ' ';

$output .= ' ";

return array($output, 'noparse' => true, 'isHTML' => true, 'noargs' => true);

}