You may also want to look into index.php?action=render&title=foo if you are doing this sort of thing.
-- brian
On Wednesday, July 19, 2017, Greg Rundlett (freephile) greg@freephile.com wrote:
On Wed, Jul 19, 2017 at 2:53 PM, Johnny Guo jguo1400@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.
Example:
This wiki content: https://freephile.org/wiki/Rates
is re-used via API on this Drupal 7 page: https://equality-tech.com/content/rates
By writing a few lines of PHP code in the Drupal page:
<?php require '/path/to/autoload.php'; $apiQuery = "?action=parse&page=Rates&format=json"; $MwApi = new \eqt\wikireport\MwApi('https://freephile.org/w/api.php'); $MwApi->makeQuery($apiQuery); $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:
https://github.com/freephile/wikireport/blob/master/vendor/eqt/wikireport/Mw...
There are all kinds of possibilities, so I'm just guessing at what you're trying to accomplish.
~ Greg
Greg Rundlett https://QualityBox.us https://eQuality-Tech.com https://equality-tech.com/ https://freephile.org
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l