Thanks for the explanation Kevin, your methods worked fine.
On Tue, Jul 29, 2014 at 12:06 PM, Kevin Israel <pleasestand(a)live.com> wrote:
On 07/29/2014 11:43 AM, Alex Monk wrote:
Argh. Apparently ctrl+enter sends the message,
whoops. Anyway, otherwise
you can use RequestContext::getMain()->getWikiPage()->getId();
On 29 July 2014 16:42, Alex Monk <krenair(a)gmail.com> wrote:
> You may already have an OutputPage object, which is a context source. If
> so you can just do $out->getWikiPage()->getId();
RequestContext and WikiPage were added in MW 1.18, so they won't be
available in the (very old, no longer supported) "pre v1.16" version
stated in the question.
In pre-1.18 versions, use $wgTitle->getArticleId() (with global
$wgTitle; in the function). However, in the skin's QuickTemplate
subclass, you can use $this->data['articleid'] (no global statement
shouldn't have to change the skin's PHP code. The variables documented
already work (e.g. alert(wgArticleId); should show the value in a dialog
box unless your MW version is older than 1.8).
> On 29 July 2014 16:26, Grue Grue
>> [...] wgArticleId seems to be the perfect
>> way to do so, as it does not change with redirects and is not defined
>> deleted or special pages.
It may change when a page is deleted and undeleted. Also, it is not
undefined for non-existent and special pages but rather zero.
Kevin Israel - MediaWiki developer, Wikipedia editor
MediaWiki-l mailing list
To unsubscribe, go to: