Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:$wgNamespaceContentModels

From mediawiki.org
Translate this page
Languages:
Content Models and Handlers
MediaWiki allows for page content types other than wikitext. It offers built-in support for JavaScript, CSS, JSON and plain text. Extensions can use MediaWiki's ContentHandler mechanism to add new content models for accepting different formats and controlling how they are rendered, stored and edited.
About
About the ContentHandler
Content handlers and their implementation
Usage
Changing the content model of a page
Changing the content model of a namespace
Extensions using the ContentHandler
Adding content models with an extension
Examples:
Configuration settings
$wgContentHandlers
$wgNamespaceContentModels
$wgContentHandlerTextFallback
$wgContentHandlerUseDB
Support and development
Latest technical documentation (Git)
Phabricator
v · d · e
Content handlers and storage: $wgNamespaceContentModels
Content types defined for a given namespace
Introduced in version:1.21.0
Removed in version:Still in use
Allowed values:Unspecified
Default value:[]
Other settings:Alphabetical |By function

Details

[edit]

Associative array mappingnamespace IDs to the name of thecontent model pages in that namespace should have by default (use theCONTENT_MODEL_XXX constants).If no special content type is defined for a given namespace, pages in that namespace will use theCONTENT_MODEL_WIKITEXT (except for the special case of JavaScript and CSS pages).

Example

[edit]

JSON

[edit]

Suppose you havecreated a new custom namespaceNS_JSON and you want all new pages in this namespace to have JSON content and to be supported by the appropriate content handler.Add the following to your LocalSettings.php file.

$wgNamespaceContentModels[NS_JSON]=CONTENT_MODEL_JSON;

If you already created pages in this namespace,see the talk page.

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:$wgNamespaceContentModels&oldid=8003468"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp