简体   繁体   中英

How to get URL-encoded page title in MediaWiki PHP extension

I'm developing a MediaWiki skin, and one of the elements I would like to use is the article URL-encoded title as the element ID or Class for styling purposes. I need help implementing this example:

This example

Assuming that you are within the execute function of your skin, you ca access the title object like this:

$title = $this->data['skin']->getTitle();

Then you can get the URL enocoded title like this:

$URLEncodedTitle = $title->getPartialURL();


If you are in the initPage function, use

$title = $this->getTitle();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM