Extension:Data Aggregator

What can this extension do?
The extension: Data Aggregator allows users to aggregate data from different pages, those pages must be conformed to a unified template. Data Aggregator will pull the specific data field from those pages and compose it into a single table. This extension can be widely used in comparison table and automated information aggregation.

For example, you have a template like this: Product Name: CPU: Memory: Hard drive: Display:

There're two pages using this template:

Page1: Product Name: PC1 CPU: 1.8G Memory: 2G Hard drive: 250GB Display: LCD

Page2: Product Name: PC2 CPU: 1.5G Memory: 1G Hard drive: 320GB Display: CRT

By using the extension: Data Aggregator, you'll be able to aggregate the data items of two pages into one table like this:

Simple Usage
Sample: .

You have to specify the template name in the syntax,please note the template name must be same as its page name, and it's case-sensitive.

For example: Assume you have a template called 'Template:My Template', and your template page is http://mymediawiki.com/Template:My_Template, that means you have to specify your template name like this:



Advanced Usage
You can choose which row title to be displayed in the table with rowtitles option:



A | (vertical bar/pipe) separates each row title. If you do not supply this option, all rows will be shown.

It is quite possible to have so many pages based on only one template, and different pages have different category, you are able to aggregate the data from the specified category by using this manner:



The category name should be assigned precisely as what you did for template name, there's no space and case sensitive in the category name. If your category name is 'My Category', then you should specify the value 'My_Category' to category flag.

You may also customize the table with the standard table tags: border, cellspacing, cellpadding, class, align, and style. For example:



Any text between  and  will appear ABOVE the table that is produced.

Installation Instruction
To install this extension, copy and save the source code as, then put it in the mediawiki extension folder e.g. /var/lib/mediawiki/extensions.

Add the following to :

require_once("extensions/data_aggregator.php");

Caching Note
MediaWiki caches pages. So, a change to a template value will not immediately show up in the Data Aggregator table. You can force it to update by going to the page with the table, clicking on edit, and then either saving the page unchanged, or - in the URL - changing "edit" to "purge". It would be nice if this extension added a small "update" link that purges the page.

License
This program is licensed under GNU GPL V2, please find the license detail in following link: http://www.gnu.org/licenses/gpl-2.0.html

Code
\n";	}	else	{		// No data found		$output.= "Template ".$argv["template"]." has no data. Please double check your template name spelling.";	}

return $output; } ?>