Revision [12106]

This is an old revision of WikipediaAction made by RolandStens on 2005-12-05 23:25:24.

 

Wikipedia Action

Last edited by RolandStens
Mon, 05 Dec 2005 23:25 UTC [diff]


This action is meant to automatically incorporate http://wikipedia.org content in your pages.
To use it as a standalone action simply add for instance:
{{wikipedia topic="Workflow"}} in the page body.

Save the code below as actions/wikipedia.php.

The action

Current version: 0.1

Changes:

To do:



actions/wikipedia.php


<?php
    $topic = $vars['topic'];
    $file = file_get_contents('http://en.wikipedia.org/wiki/'.$topic);
    $file = str_replace('href="/', 'href="http://en.wikipedia.org/', $file);
    preg_match_all('#<!-- start content -->(.*?)<!-- end content -->#es', $file, $ar);
    unset($file);
    if (is_array($ar[1])) echo $ar[1][0];
    else echo '';
?>



There are 7 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki