手册:$wgNamespaceContentModels

This page is a translated version of the page Manual:$wgNamespaceContentModels and the translation is 60% complete.
内容处理程序和存储: $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.