Extension:TemplateTable

TemplateTable is an extension that creates tables based on template data.

See also: Extension:SMW.

Example
Consider the situation where you have a wiki that has template:Restaurant with the fields Name, Price, and Cuisine. You want to have a single table somewhere that shows all the data and auto-updates when a template is updated for a restaurant or a new restaurant is added. You add the table with &lt;ttable template='Restaurant'&gt;&lt;/ttable&gt; and you would get something like:

Documentation
Complete documentation is in the code.

The options available inside the ttable tag are:
 * template: This is required. It must match the case on the "Template:NameOfTemplate" page.
 * headers: You can customize which columns to show. Values are separated by |, as in: headers='Name|Price|Location'
 * Standard table tag options: border, cellspacing, cellpadding, align, style
 * Any text between &lt;ttable&gt; and &lt;/ttable&gt; will appear above the table created.

History
2006-08-02 Version 1 of TemplateTable released.

Caching note
MediaWiki caches pages. So, a change to a template value will not immediately show up in the ttable table. You can force it to update by going to the page with the ttable, 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.

Without some additional cache management, the extension will always show the data that were present the last time someone manually saved or purged the page, making this extension problematic in practice.

Code
\n";	}	else	{		// Print a nice (no data found) message:		$output.= "Template ".$argv["template"]." has no data.";	}

return $output; } ?>