Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get URL for mediawiki page given the Title - programmatically in PHP [closed]

Tags:

php

mediawiki

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!

like image 673
Evgeny Avatar asked Jul 31 '09 01:07

Evgeny


Video Answer


2 Answers

The answer above should work fine except for a minor typo (Text instead of Test).

$title = Title::newFromText("Title");
$title->getFullURL();
like image 178
Laurent Alquier Avatar answered Sep 25 '22 06:09

Laurent Alquier


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.

like image 25
Tyler Carter Avatar answered Sep 21 '22 06:09

Tyler Carter