|Ta funkcja została całkowicie usunięta w wersji 1.23.0.|
|Obiekt globalny: $wgArticle|
|Article object (or child object of Article) corresponding with Title object|
|Zlokalizowany w:||Article.php, CategoryPage.php, ImagePage.php|
The Article object encapsulates access to the "page" table of the database. The object represents an article, and maintains state such as text (in Wikitext format), flags, etc.
Theand objects are child objects of the Article object, and are used specifically for Category pages and Image pages.
Use the Context object to get what you need. Since 1.19, Context objects have a
getWikiPage() to access the corresponding
object. Where you get this context object from depends on where your code is running. Many major classes extend
, which means you can just do
$someObject->getContext() to get the context and
$someObject->getWikiPage() for the
WikiPage object. As of this writing that includes
Skin. Some other classes support
getContext() which don't have
ContextSource as a parent class, such as
SpecialPage (So if you're writing a
SpecialPage, you can often do
$this->getContext() to get the context).
If you need to use a method which is in
Article but not
WikiPage and have a context object, say
$context, you can use
Article::newFromTitle( $context->getTitle(), $context );, please also note the following things:
- The displayed revision's ID is accessible through
Skin->getRevisionId()and the fact that this is the current revision of the page can be accessed through
- The text of the latest revision of the current page (not necessarily of the displayed revision) is accessible through
WikiPage->getRawText(); depending on what you use
Article->getContent()for, you may prefer this one.
$article->getPage()->getContent()->getNativeData() to replace this.