帮助:Widget
小部件扩展允许在普通的wiki页面插入原始的HTML页面(类似模板)。 您可以通过在Widget名字空间创建页面来完成。 这避免了在可编辑Wiki页面中原始HTML的安全性问题,因为在Widget名字空间中进行编辑的权限是受控的。 您可以找到一些预先写好的小部件[1]。
相关权限
这个扩展添加了一个名为“Widget”的命名空间,但由于使用不安全的小部件代码可能导致潜在的安全隐患,这个命名空间只能由拥有editwidgets
权限的用户编辑(该widgeteditor
组也被创建以添加用户。
用法
To add a widget to your MediaWiki installation, just create a page in the Widget: namespace and then use the {{#widget:...}}
parser function to include it in the pages of the wiki.
{{#widget}}
解析器函数
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="">'</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.
Widget名字空间的页面
All widgets in the wiki are defined by creating pages in the special "Widget:" namespace like e.g. "Widget:WidgetName", which is automatically added to your wiki when you install this extension.
To see all Widgets defined in your system, you can simply go to the page "Special:AllPages", select "Widget" in the namespace dropdown and click "Go".
For security reasons, these pages are only editable by wiki administrators - see User rights below for more info.
You can find many pre-defined widgets to install in your wiki at MediaWikiWidgets.org. If you are interested in creating widgets yourself, see the next section.