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!
The answer above should work fine except for a minor typo (Text instead of Test).
$title = Title::newFromText("Title");
$title->getFullURL();
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With