MediaWiki/archive/embedding/1.14/index.php

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< MediaWiki‎ | archive‎ | embedding
Revision as of 23:05, 6 June 2009 by Woozle (talk | contribs) (New page: ==Code== <php><?php →‎HISTORY: 2009-06-06 Now works with MediaWiki 1.14 and current version of extract.php: define('kfpWebAccts','/var/www/'); define('kfpMediaWiki',kfpWebAccts.'wiki-...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Code

<php><?php /* HISTORY:

 2009-06-06 Now works with MediaWiki 1.14 and current version of extract.php
  • /

define('kfpWebAccts','/var/www/'); define('kfpMediaWiki',kfpWebAccts.'wiki-hypertwins-org/');

// To have all your extractable pages as subpages or in a namespace, give them a prefix: define('kEmbeddedPagePrefix',); /* This can be empty, but the idea is that you might want to avoid conflicts between the names of your embedded pages and the names of regular pages in your wiki (if you're using the wiki as a regular wiki too). It all depends on how you are using the embedded pages.

  • /

set_include_path(get_include_path() . PATH_SEPARATOR . kPathToMediaWiki); $pgtitle = $_REQUEST['wikipage']; if ($pgtitle == ) { $pgtitle = 'Main Page'; // default page to show }

?> <html> <head> <?php /* Code for displaying meta tags from wiki page

  • /

/* // uncomment this section to enable meta-tag insertion $action = 'raw'; $title = 'Site meta tags';

// butchered extract.php code require_once( kPathToMediaWiki.'includes/WebStart.php' ); require_once( kPathToMediaWiki.'includes/Wiki.php' ); $mediaWiki = new MediaWiki(); wfProfileIn( 'main-misc-setup' ); OutputPage::setEncodings(); # Not really used yet

$wgTitle = Title::newFromURL( $title ); if ($wgTitle == NULL) { unset( $wgTitle ); } $wgArticle = new Article($wgTitle); $wgArticle->loadContent(); echo $wgArticle->mContent;

/* End of meta tag code

CSS code below is just for standalone presentation.

  • /

?> <style> img { border-style: none; } .mw-headline { color: #666666; } .commentBlock { color: #555555; font: 10pt sans-serif; } body { color: #666677; } A:link, A:active, A:visited { color: #555566; } h1 { font: 14pt sans-serif; } h2 { font: 12pt sans-serif; } </style> </head> <body bgcolor=#ffffff> <?php $action = 'render'; $title = $pgtitle; include '/var/www/data/lib/php/extract.php'; // point this to wherever you keep extract.php $out = GetWikiPage($pgtitle); echo $out; ?> </body></html></php>