手册:$wgNamespaceContentModels
Appearance
| 内容模型及处理器 |
|---|
| MediaWiki允许维基文本之外的页面内容类型。 提供对JavaScript、CSS、JSON和纯文本的内置支持。 扩展程序可以使用MediaWiki的内容处理器(ContentHandler)机制来添加新的内容模型,以便接受不同格式的文本,并控制这些页面如何渲染、存储和编辑。 |
|
关于内容处理器 内容处理器及其实现 |
|
更改页面的内容模型 更改命名空间的内容模型 使用内容处理器的扩展程序 添加带扩展名的内容模型 示例: |
|
$wgContentHandlers $wgNamespaceContentModels |
| 支持和发展 |
|
|
| 内容处理程序和存储: $wgNamespaceContentModels | |
|---|---|
| 为给定命名空间定义的内容类型 |
|
| 引进版本: | 1.21.0 |
| 移除版本: | 仍在使用 |
| 允许的值: | 未指定 |
| 默认值: | [] |
| 其他设置: 按首字母排序 | 按功能排序 | |
细节
Associative array mapping namespace IDs to the name of the content model pages in that namespace should have by default (use the CONTENT_MODEL_XXX constants).
If no special content type is defined for a given namespace, pages in that namespace will use the CONTENT_MODEL_WIKITEXT (except for the special case of JavaScript and CSS pages).
示例
JSON
Suppose you have created a new custom namespace NS_JSON and you want all new pages in this namespace to have JSON content and to be supported by the appropriate content handler.
将这一行添加到你的LocalSettings.php中:
$wgNamespaceContentModels[NS_JSON] = CONTENT_MODEL_JSON;
If you already created pages in this namespace, see the talk page.