[MediaWiki-l] Drupal 7 and MediaWiki

Greg Rundlett (freephile) greg at freephile.com
Wed Jul 19 19:24:07 UTC 2017

On Wed, Jul 19, 2017 at 2:53 PM, Johnny Guo <jguo1400 at gmail.com> wrote:

> I was wondering if it was possible to have a MediaWiki section inside a
> Drupal website and how it would be done.

Any more details on what you're trying to accomplish?

Are you talking about a "headless" or "decoupled" content reuse through
API?  Drupal allows PHP code in pages, and MW has an API.  So, if all you
want to do is have some wiki page content show up on your Drupal site, you
can do that with a few lines of PHP code.


This wiki content:

is re-used via API on this Drupal 7 page:

By writing a few lines of PHP code in the Drupal page:

require '/path/to/autoload.php';
$apiQuery = "?action=parse&page=Rates&format=json";
$MwApi = new \eqt\wikireport\MwApi('https://freephile.org/w/api.php');
$data = $MwApi->data;
print ($data['parse']['text']['*']);

The autoload.php file in the first line above is something I generated with
Composer for the WikiReport project, and essentially all it does is load a
very basic class that I wrote to make queries to the MediaWiki API:

There are all kinds of possibilities, so I'm just guessing at what you're
trying to accomplish.

~ Greg

Greg Rundlett
https://eQuality-Tech.com <https://equality-tech.com/>

> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

More information about the MediaWiki-l mailing list