MediaWiki/archive/embedding/1.16/index.php
Jump to navigation
Jump to search
YOUR SITE NAME
About
This works with MediaWiki v1.16.x.
Instructions
- Set $wpWikiBase to the folder containing your MediaWiki installation
- Change YOUR SITE TITLE to whatever you want to show up as the title in the brower's titlebar
- Put this file (index.php) in the folder where you want the pages to appear. (I've only tested this in "/", however.)
- Modify Apache/.htaccess -- see /.htaccess
- Whatever is in [[project:Transclude/]] will appear (without the wiki skin) at http://yourdomain.com, [[project:Transclude/a page]] will appear at http://yourdomain.com/a_page, and so on.
Future
- It should be simple enough to have a base title plus the page title, or even a title defined within the wikitext.
- I haven't tested to see if a trailing "/" brings up a different page or not; if it does, then trimming off trailing "/"s from the request should fix that.
Code
<php><?php $wpWikiBase = '/wiki'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
GetText('title');
$action = 'view';
$wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
//$wgArticle = MediaWiki::articleFromTitle( $wgTitle );
//$wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
$mediaWiki->performRequestForTitle( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
require_once( "$preIP/includes/Article.php" );
global $wgParser;
$txtPage = $wgArticle->getContent();
//$out = $wgParser->recursiveTagParse($txtPage);
$objOptions = new ParserOptions();
$objPOut = $wgParser->parse( $txtPage, $wgTitle, $objOptions );
$out = $objPOut->getText();
echo $out;
echo '
';</php>