[MediaWiki-l] Drupal 7 and MediaWiki

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[MediaWiki-l] Drupal 7 and MediaWiki

Johnny Guo
I was wondering if it was possible to have a MediaWiki section inside a
Drupal website and how it would be done.
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Drupal 7 and MediaWiki

Greg Rundlett (freephile)
On Wed, Jul 19, 2017 at 2:53 PM, Johnny Guo <[hidden email]> 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/MwApi.php

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Drupal 7 and MediaWiki

Brian Wolff
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) <[hidden email]>
wrote:

> On Wed, Jul 19, 2017 at 2:53 PM, Johnny Guo <[hidden email]> 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/MwApi.php

>
> 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
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Loading...