Get URL for mediawiki page given the Title - programmatically in PHP [closed]
Question
how can I get URL for an Article in MediaWiki given the title?
I want to create links to certain pages in the skin template programmatically using PHP right now I am doing this:
<a href="<?php $wgScriptPath ?>/index.php/Page_title">Page title</a>
Which is a bit too wordy, I'd like something
<?php page_link_by_title("Page_title") ?>
Thanks!
Solution
The answer above should work fine except for a minor typo (Text instead of Test).
$title = Title::newFromText("Title");
$title->getFullURL();
OTHER TIPS
Try this
$title = Title::newFromText("Title");
$title->getFullURL();
That should create a new Title Class (svn.wikimedia.org/doc/classTitle.html), and retrieve the Full URL.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow