Open main menu
English  • Deutsch • 中文
This is technical documentation of the extension. There is also a user documentation.
MediaWiki扩展手册
OOjs UI icon advanced.svg
TemplateSandbox
发布状态: 稳定版
Screenshot of TemplateSandbox.png
实现 Special page , Page action
描述 Preview pages using sandboxed templates
作者 Brad Jorsch (Anomietalk)
最新版本 1.1.0 (2014-03-29)
兼容性方针 发行分支
MediaWiki 1.21+
PHP 5.5+
数据更新
许可协议 GNU General Public License 2.0 or later
下载
  • $wgTemplateSandboxEditNamespaces
翻译TemplateSandbox扩展如果在translatewiki.net可用
检查使用和版本矩阵。
问题 开放的工作 · 报告错误

The TemplateSandbox extension adds the ability to preview a page using sandboxed versions of templates, allowing for easy testing before making the sandbox code live. It also works with Scribunto modules.

安装Edit

  • 下载文件,并将其放置在您extensions/文件夹中的TemplateSandbox目录内。
  • 将下列代码放置在您的LocalSettings.php的底部:
    wfLoadExtension( 'TemplateSandbox' );
    
  •   完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

致使用MediaWiki 1.24或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.24和更早版本)中安装此扩展,而不是wfLoadExtension( 'TemplateSandbox' );,您需要使用:

require_once "$IP/extensions/TemplateSandbox/TemplateSandbox.php";

ConfigurationEdit

Parameters
  • $wgTemplateSandboxEditNamespaces: Namespaces in which to show the "Preview page with this template" box below the edit form. NS_TEMPLATE by default. Can be expanded to all namespaces by individual users using advancedtemplatesandbox.js.

UsageEdit

The extension adds a new special page, Special:TemplateSandbox. To preview a page using sandboxed templates, do the following:

  1. Copy the templates to be tested under a common prefix. For example, you might copy Template:Foo to User:Example/sandbox/Template:Foo. Alternatively, you might create User:Example/sandbox/Template:Foo as a redirect to Template:Foo/sandbox.
  2. Go to Special:TemplateSandbox. Fill in the page or revision to be rendered, and the prefix you chose in step 1. It is possible to specify multiple prefixes (a prefix search path) by separating them using vertical bars, e.g. User:Example/sandbox1|User:Example/sandbox2.
  3. Click View.

The extension also adds a box at the bottom of the edit form for pages in the namespaces configured in $wgTemplateSandboxEditNamespaces. This allows for previewing some other page as it would appear were the template being edited saved with the current contents of the edit form.

参见Edit