Difference between revisions of "MediaWiki/archive/embedding"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(moved a referenced page; some spam got in here that I never noticed, too)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
==Overview==
 
==Overview==
This page is about embedding [[MediaWiki]] content within <span class="plainlinks">[https://www.proposable.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">proposal software</span>] non-MediaWiki sites, or as standalone pages without the standard navigation and control links provided by most [[MediaWiki skin]]s.
+
This page is about embedding [[MediaWiki]] content within <span class="plainlinks">[https://www.proposable.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">proposal software</span>] non-MediaWiki sites, or as standalone pages without the standard navigation and control links provided by most [[MediaWiki/archive/skins|MediaWiki skin]]s.
  
 
==non-PHP==
 
==non-PHP==
This is easiest to do if the other application is also written in [[PHP]], <span class="plainlinks">[http://travelitineraries.net/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Travel Itineraries</span>] but it is possible to do this using <span class="plainlinks">[http://www.diamondlinks.net/<span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">link building</span>] other languages as well. [[Perl]] has a library, [http://search.cpan.org/~gschloss/PHP-Interpreter-1.0.1/lib/PHP/Interpreter.pm PHP::Interpreter], that <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] allows it to execute PHP code; other languages may have similar capabilities.
+
This is easiest to do if the host application is also written in [[PHP]], but it is possible to do this using other languages as well. [[Perl]] has a library, [http://search.cpan.org/~gschloss/PHP-Interpreter-1.0.1/lib/PHP/Interpreter.pm PHP::Interpreter], that allows it to execute PHP code; other languages may have similar capabilities.
  
If they do not, then one can still accomplish a <span class="plainlinks">[http://www.bestpills4weightloss.com/<span style="color:black;font-weight:normal; text-decoration:none!important;background:none!important; text-decoration:none;">best weight loss pills</span>] certain amount by loading MediaWiki pages using [[http]] and the "?action=render" directive, which displays the page's <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>]
+
If they do not, then one can still accomplish a certain amount by loading MediaWiki pages using [[http]] and the "?action=render" directive, which displays the page's bare contents without any of the navigation aids. (This method is not recommended if you have any alternatives, as it is slow and wasteful of CPU resources.)
bare contents without any of the <span class="plainlinks">[http://www.facebook.com/bsafans <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Beauty Schools of America Complaints</span>] navigation <span class="plainlinks">[http://www.facebook.com/pages/Carousel-Day-School-and-Summer-Program/142341952505011 <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Carousel Day School</span>] aids. (This <span class="plainlinks">[http://www.merchantservicesprotectionplan.info/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Merchant Services Protection Plan</span>] method is not recommended if you have any alternatives, as it is slow and wasteful of CPU resources.)
 
  
 
==PHP==
 
==PHP==
Line 13: Line 12:
 
These have been tested with MediaWiki v'''1.14'''.
 
These have been tested with MediaWiki v'''1.14'''.
 
* [[/1.14/index.php]] is a usage example; as given, it provides a standalone page, but it also shows the code needed to retrieve page content
 
* [[/1.14/index.php]] is a usage example; as given, it provides a standalone page, but it also shows the code needed to retrieve page content
* [[/1.14/extract.php]] is the code which actually does the work of extraction; the function GetWikiPage($iTitle) returns the page's contents <span class="plainlinks">[http://www.casinos-jackpots.net/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">casino</span>] as a string.
+
* [[/1.14/extract.php]] is the code which actually does the work of extraction; the function GetWikiPage($iTitle) returns the page's contents as a string.
 
Configuration info is in index.php. Note that this has not been tested ''very much''; I got it working on my server, then posted it.
 
Configuration info is in index.php. Note that this has not been tested ''very much''; I got it working on my server, then posted it.
  
Line 22: Line 21:
 
* [[/old/extract.php/v1]]
 
* [[/old/extract.php/v1]]
 
===To Do===
 
===To Do===
* I need to work out the code for detecting if a given page exists in the wiki, so the main application can display default values other than the wiki's default ("This page doesn't exist yet..."). Detecting <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>] this with the method below may or may not be possible; if MediaWiki returns a 404 code for non-existent articles, then that <span class="plainlinks">[http://www.premierrivercruises.com/river-cruise-regions-of-the-world/vietnam-river-cruise<span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Vietnam river cruises</span>] could be used, but I don't yet know if it does. --[[User:Woozle|Woozle]] 18:52, 15 October 2006 (EDT)''
+
* I need to work out the code for detecting if a given page exists in the wiki, so the main application can display default values other than the wiki's default ("This page doesn't exist yet..."). Detecting this with the method below may or may not be possible; if MediaWiki returns a 404 code for non-existent articles, then that could be used, but I don't yet know if it does. --[[User:Woozle|Woozle]] 18:52, 15 October 2006 (EDT)''
* We don't yet know how to get MediaWiki to emit fully-qualified URLs; it is currently necessary to do a search-and-replace to fix links targeting the wiki. (It's probably a configuration thing -- $wgArticlePath, I'd guess. Don't know if link URLs get <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">food gift baskets</span>] cached, though, so that might not work reliably. --[[User:Woozle|Woozle]] 19:29, 6 June 2009 (EDT))
+
* We don't yet know how to get MediaWiki to emit fully-qualified URLs; it is currently necessary to do a search-and-replace to fix links targeting the wiki. (It's probably a configuration thing -- $wgArticlePath, I'd guess. Don't know if link URLs get cached, though, so that might not work reliably. --[[User:Woozle|Woozle]] 19:29, 6 June 2009 (EDT))

Latest revision as of 00:19, 15 December 2017

Overview

This page is about embedding MediaWiki content within proposal software non-MediaWiki sites, or as standalone pages without the standard navigation and control links provided by most MediaWiki skins.

non-PHP

This is easiest to do if the host application is also written in PHP, but it is possible to do this using other languages as well. Perl has a library, PHP::Interpreter, that allows it to execute PHP code; other languages may have similar capabilities.

If they do not, then one can still accomplish a certain amount by loading MediaWiki pages using http and the "?action=render" directive, which displays the page's bare contents without any of the navigation aids. (This method is not recommended if you have any alternatives, as it is slow and wasteful of CPU resources.)

PHP

This works with MediaWiki v1.16:

These have been tested with MediaWiki v1.14.

  • /1.14/index.php is a usage example; as given, it provides a standalone page, but it also shows the code needed to retrieve page content
  • /1.14/extract.php is the code which actually does the work of extraction; the function GetWikiPage($iTitle) returns the page's contents as a string.

Configuration info is in index.php. Note that this has not been tested very much; I got it working on my server, then posted it.

Works on MW 1.10:

Based on MW somewhere around 1.7:

To Do

  • I need to work out the code for detecting if a given page exists in the wiki, so the main application can display default values other than the wiki's default ("This page doesn't exist yet..."). Detecting this with the method below may or may not be possible; if MediaWiki returns a 404 code for non-existent articles, then that could be used, but I don't yet know if it does. --Woozle 18:52, 15 October 2006 (EDT)
  • We don't yet know how to get MediaWiki to emit fully-qualified URLs; it is currently necessary to do a search-and-replace to fix links targeting the wiki. (It's probably a configuration thing -- $wgArticlePath, I'd guess. Don't know if link URLs get cached, though, so that might not work reliably. --Woozle 19:29, 6 June 2009 (EDT))