Sandbox

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by 172.128.59.74 (talk) at 05:58, 22 December 2004. It may differ significantly from the current version.

This page is for editing experiments. Content added here will not stay !Headline

!! more

WikiWord


--209.150.52.216 04:10, 16 Dec 2004 (UTC) [[[[math:\alpha^2+\beta^2=1]]]]

Content added below this line stays permanently

<tagname> some text </tagname>

<?php

  1. Example WikiMedia extension
  2. with WikiMedia's extension mechanism it is possible to define
  3. new tags of the form
  4. <TAGNAME> some text </TAGNAME>
  5. the function registered by the extension gets the text between the
  6. tags as input and can transform it into arbitrary HTML code.
  7. Note: The output is not interpreted as WikiText but directly
  8. included in the HTML output. So Wiki markup is not supported.
  9. To activate the extension, include it from your LocalSettings.php
  10. with: include("extensions/ExampleExt.php");

$wgExtensionFunctions[] = "wfExampleExtension";

function wfExampleExtension() {

   global $wgParser;
   // register the extension with the WikiText parser
   // the first parameter is the name of the new tag. In this case it defines the tag <example> ... </example>
   // the second parameter is the callback function for processing the text between the tags
   $wgParser->setHook( "example", "renderExample" );

}

// The callback function for converting the input text to HTML output function renderExample( $input ) {

$output = "

Text passed into example extension: <br>". $input. "

";

   return $output;

} ?>