Extension:Widgets

Widgets extension allows adding widgets to wiki by just creating pages in Widget namespace.

This extension was developed by Sergey Chernyshev for Ardorado.com and sponsored by Semantic Communities, LLC.

Usage
To add a widget to MediaWiki installation, just create a page in Widget namespace and then use  parser function to include it to the pages of the wiki.

parser function
To add defined widget to pages, users can use  parser function. The syntax is as follows:

Where WidgetName is a page name in Widget namespace (e.g. Widget:WidgetName) and param=value pairs are defining parameters defined within widget code.

Widget page syntax
Widget extension uses Smarty PHP templating engine to provide simple templating functionality within widget pages. All parameters passed to widget are converted into Smarty parameters.

You should use escape modifiers to make sure that user parameters can not expose hosting website to XSS (or any other) attacks.

Refreshing widget page
If you're using a call to the widget within the widget page itself, then you will not see the updated widget (and no widget at all when you just created a page). This happens because page contents are not available to Widget extension until page is saved, but the call to  parser function is made before page is saved. After pages is saved, it's being cached by MediaWiki so you don't see the result even if you just reload the page. To make latest edits of the widget code to work, you need to refresh the page in the cache, to do this, you just need to use  action (see also Purgetab extension).

Download instructions
Download the code archive and extract it to  folder. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installing from tarball
You can download Widgets code here:
 * Widgets-0.6.tgz - compressed using tar and gzip
 * Widgets-0.6.zip - compressed using zip

Installing from SVN
To get code from Subversion, just type svn checkout http://mediawiki-widgets.googlecode.com/svn/trunk/ Widgets

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

Also,  folder should be writable by web server (this is where Smarty stores pre-compiled templates).

Configuration parameters
You can set namespace ID to something different then default (274), make sure that it's an even number. Talk namespace ID will be

User rights
This extension adds Widget namespace, but due to potential security implications that can result from using insecure widget code, this namespace is only editable by users who have  permission (  group is also created to add users to, see Help:User rights management for more details).

CHANGES

 * 0.6 (May 9, 2008) - Minor tweaks and bug fixes, release Makefile
 * 0.5 (Feb 11, 2008) - First public release

TODO

 * implement square bracket parameter parsing to support passing arrays (regular and associative)

Contributing code and widgets
If you would like to contribute patches or found some problems with the code, please send message to the discussion group.

If you created a widget and would like to share it, feel free to add it to Widgets library, you can also post it to MediaWikiWidgets.org - open hosting for widgets.

Support
The best way to seek help with this widget is MediaWiki Widgets Google group - extension maintainer and active users and contributors are on this list and will be able to help you.

Widgets library
MediaWikiWidgets.org contains a full library of ready-made widgets, including support for most of the major video sites. Any widget can be used simply by copying over the contents of the page. Some sample widgets from that site are:


 * Feed - displays the most recent articles from an RSS feed
 * Flickr - displays a set of images from Flickr that match a certain keyword
 * SlideShare - adds SlideShare slideshow player
 * YouTube - embeds a YouTube video