How do I install Presto MediaWiki Plugin?

Posted 10/27/2009 - 14:41 by Deepak Alur

Presto Mashlets can be embedded in MediaWiki pages by using a special Mashlet tag. In order for this to work, there are 2 steps you must follow:

Step 1: You need to modify the LocalSettings.php file to add the Mashlet plugin

include_once("extensions/Mashlets.php" );

Step 2: Create a Mashlets.php file under extensions directory with the following code:

 some text 
# the function registered by the extension gets the text between the 
# tags as input and can transform it into arbitrary HTML code.
# Note: The output is not interpreted as WikiText but directly 
# included in the HTML output. So Wiki markup is not supported.
# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/mashlet.php"); 

$wgExtensionFunctions[] = "mashletExtension";

function mashletExtension() {
        global $wgParser;
        # register the extension with the WikiText parser
        # the first parameter is the name of the new tag.
        # the second parameter is the callback function for processing the text between the tags
        $wgParser->setHook( "mashlet", "renderMashlet" );
}

# The callback function for converting the input text to HTML output
function renderMashlet( $input ) {

        $tokens = explode(" ",$input);
        $mashleturl=$tokens[0];
        $output = "";

        return $output;
}

Once this is done, you can add Mashlets to your MediaWiki pages by following the instructions:

Steps to add a Mashlet to your MediaWiki page:

  1. Create and save a new mashlet or click share from the footer of an existing mashlet.
  2. Click the appropriate link.
    1. When you create a mashlet, click Copy to Clipboard in the MediaWiki Tag section.
    2. When you use a mashlet, click the MediaWiki icon in the share icons.
  3. This copies the wiki code to the clipboard that you will need to embed the mashlet in a web page.
    In any text editor, edit the wiki page to which you want to add the mashlet.
    Paste the MediaWiki Tag code in the page at the position where the mashlet should appear.
    Save your changes.

Mash On!
- deepak alur | vp product + engineering at jackbe  | follow me

0
Your rating: None