MediaWiki命名空间、index.php参数
2020-10-23
每个对象都有讨论页,id + 1。
一般通过title实例可获取:
$this->mTitle->getNamespace()
https://en.wikipedia.org/wiki/Wikipedia:Namespace
Subject namespaces | Talk namespaces | ||
---|---|---|---|
0 | (Main/Article) | Talk | 1 |
2 | User | User talk | 3 |
4 | Wikipedia | Wikipedia talk | 5 |
6 | File | File talk | 7 |
8 | MediaWiki | MediaWiki talk | 9 |
10 | Template | Template talk | 11 |
12 | Help | Help talk | 13 |
14 | Category | Category talk | 15 |
100 | Portal | Portal talk | 101 |
118 | Draft | Draft talk | 119 |
710 | TimedText | TimedText talk | 711 |
828 | Module | Module talk | 829 |
具体定义:./includes/Defines.php
define( 'NS_MAIN', 0 ); define( 'NS_TALK', 1 ); define( 'NS_USER', 2 ); define( 'NS_USER_TALK', 3 ); define( 'NS_PROJECT', 4 ); define( 'NS_PROJECT_TALK', 5 ); define( 'NS_FILE', 6 ); define( 'NS_FILE_TALK', 7 ); define( 'NS_MEDIAWIKI', 8 ); define( 'NS_MEDIAWIKI_TALK', 9 ); define( 'NS_TEMPLATE', 10 ); define( 'NS_TEMPLATE_TALK', 11 ); define( 'NS_HELP', 12 ); define( 'NS_HELP_TALK', 13 ); define( 'NS_CATEGORY', 14 ); define( 'NS_CATEGORY_TALK', 15 );
index.php参数
主要关心title和action参数,类型非常多。
根据index.php参数和命名空间,大致能获取到当前页面情况。
接触MediaWiki还不久,功能着实丰富和复杂,详细原理有待进一步学习。
https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php/zh#Options_affecting_the_edit_form