No categories assigned

Widgets

Revision as of 15:06, 5 December 2017 by Lsireta (talk | contribs) (Created page with "The '''Widgets''' extension allows the creation of raw HTML pages that can be embedded (similarly to templates) in normal wiki pages. You do this by creating pages in the '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Widgets extension allows the creation of raw HTML pages that can be embedded (similarly to templates) in normal wiki pages. You do this by creating pages in the Widget namespace. They avoid the security problems of raw HTML in editable wiki pages because the privilege to edit in the Widget namespace is managed. Many pre-written Widgets are available.


Usage[<a href="https://www.mediawiki.org/w/index.php?title=Extension:Widgets&action=edit&section=6" title="Edit section: Usage">edit]

To add a widget to your MediaWiki installation, just create a page in the Widget: namespace and then use the 

Error in widget ...: Unable to load template 'wiki:...'

 parser function to include it in the pages of the wiki.

{{#widget}} parser function[<a href="https://www.mediawiki.org/w/index.php?title=Extension:Widgets&action=edit&section=7" title="Edit section: {{#widget}} parser function">edit]

To add a defined widget to pages, users can use the {{#widget}} parser function. The syntax is as follows:

{{#widget:WidgetName|param1=value1|param2=value2}}

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

Parameters can be expanded inside a widget using Smarty syntax, as follows:

<a href="<!--{$param1|escape:'url'}-->"><!--{$param2|escape:'html'}--></a>

The escape options specifies how the parameter will be 'escaped', or encoded, in the resultant Widget. See http://www.smarty.net/docsv2/en/language.modifier.escape for more information on this.


Source: mediawiki

Attachments

Discussions