VirtualMV/Digital Learning Technologies/Extending wikis and blogs/MediaWiki

From WikiEducator
Jump to: navigation, search



Overview

Media wiki can be extended in several ways

  1. Client-Side JavaScript
  2. Templates
  3. Extensions
  4. Widgets
  5. Miscellaneous Tools

The MediaWiki codebase contains various "hooks" using callback functions to add additional code in an extensible way. This allows developers to write extensions without modifying the core or having to submit their code for review. Installing an extension typically consists of adding a line to the configuration file, though in some cases additional changes such as database updates are required. Wikipedia:MediaWiki(2009)[1]

JavaScript

Media wiki allows a special page MediaWiki:Common.js that is loaded every time a page is displayed. It is not editible by users and is created by the system admin.

JavaScript inpage

In here I'd love to include a basic javascript that demonstrates how it can be included on a web page, something like..

<script type="text/javascript">
  function fnHello() {
    alert("HELLO");
  }
</script>
<form>
    <input type="button" onclick="fnHello()" value="Call function" />
</form>

Reference: wikibooks:MediaWiki Developer's Handbook/Add JavaScript (2009)[2] - really cryptic and really no help at all yet :)

However Media wiki describes an extension (Extension:Javascript, 2009, June 27)[3] which I must try (I want to add a text size JavaScript element).

Extensions

Extensions are added by the system administrator and the functionality is then added to the wiki. As at March 2012 there were approximately 2,000 extensions and documentation for Mediawiki includes an Extension Matrix and a table describing the extensions.

Adding an extension

To add an extension usually requires that you

  • Find the extension you want, (e.g. Geshi - a Syntax highlight text snippets, whole pages or whole files).
  • Read the Installation instructions which usually follows
    • Download the code (usually in a compressed archive) and decompress if necessary. This will be in a folder (e.g. SyntaxHighlight_GeSHi )
    • Upload (FTP) this folder to the Extensions Folder on your web server.
    • Add the hook into the LocalSettings.php file in the wiki folder, ( e.g. require_once( "$IP/extensions/geshi/geshi.php" ); )

This is then activated by adding the following into the wiki


<source lang="javascript">
/*Code in here e.g. Javascript
/*More code
</source>

/*Code in here e.g. Javascript
/*More code

Depending on the browser, the code appears in a very small font (I have modified this using a template for vMVwiki to add a box border around as well.


The cite extension

The cite extension creates a linked page that produces a variety of referencing styles for your page. An extra option is added to the toolbox (in the left panel) called cite this page. If you click on this link a page showing a variety of referencing styles is displayed for the page.

In the wiki you can have the reference appear at the bottom of the page using the <ref> tag. There is an example of implementing an APA style citation/Reference at DLT Overview, Teaching.


VmvIcon Activity.png

Use the cite extension in Wikipedia to paste a URL into your user page

  1. Find a content page in wikipedia
  2. If the Toolbox in the left panel is collapsed, expand the toolbox.
  3. Click on Cite this page
  4. Copy the APA reference to the clipboard (Highlight and Ctrl+C ), and paste into your user page.

Templates

In wiki syntax, a template is identified by a page surrounded by curly brackets ({{ ... }}). There is a template language that allows you to build a page which you can pass variable to. Examples of template pages are:

  • a box template to create the pedagogical boxes (called instructional Devices (iDevices) in WikiEducator ) - like activities
  • a Footer template which also generates an APA style reference is shown below:
==References==
<references />
<p>&nbsp;</p>
<div style="font-family: menu,Arial; border: 1px solid #0000FF;font-size: x-small; background-color: #E6F2FF;">
{{{1}}} ({{CURRENTYEAR}}). ''{{PAGENAME}}''. Retrieved {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}},
 from {{fullurl:{{PAGENAME}}}}</div>

and call it at the bottom of a wiki page using

{{Template:APAFooter|Me}}

The {{1}} allows you to pass a parameter to the template, in this case "Me" (parameters are separated by a | )

Which will produce

Me (2017). VirtualMV/Digital Learning Technologies/Extending wikis and blogs/MediaWiki. Retrieved November 18, 2017,

from //wikieducator.org/VirtualMV/Digital_Learning_Technologies/Extending_wikis_and_blogs/MediaWiki


VmvIcon Activity.png

Pedagogical template

  1. Review adding Boxes to a wiki in Quick tips
  2. Add one of the following boxes to your user page (Note, Notes, Objective(s), Example(s), KeyPoint(s), More, Question(s),NZ, Activity).
  3. Review what WikiEducator Quickstart guide/pedagogical templates (or iDevices) are available in WikiEducator.


VmvIcon Activity.png

Syntax Highlighter

  1. Review Adding computer source code Quick tips
  2. Using the vmv:Source template add some source code to your user page

Mediawiki activity

VmvIcon Assessed Activity.png
Assessed Activity 4.2 (2016)
  • Add components to your user page:
    1. APA reference for a page about digital learning technologies from Wikipedia
    2. Pedagogical template
    3. Syntax highlighter
  • Add a blog post with a link to your wiki user page.
  • Source: MediaWiki Activity

VmvIcon References.png References

  1. Wikipedia:MediaWiki(2009) Media Wiki: Customisation. Retrieved June 6, 2009 from http://en.wikipedia.org/wiki/MediaWiki#Customization
  2. wikibooks:MediaWiki Developer's Handbook/Add JavaScript (2009) MediaWiki Developer's Handbook/Add JavaScript. Retrieved June 6, 2009 from http://en.wikibooks.org/wiki/MediaWiki_Developer's_Handbook/Add_JavaScript
  3. Extension:Javascript. (2009, June 27). MediaWiki, The Free Wiki Engine. Retrieved 11:24, October 7, 2009 from http://www.mediawiki.org/w/index.php?title=Extension:Javascript&oldid=262504

virtualMV  |  Superquick wiki guide  |  Please give me some feedback

VirtualMV/Digital Learning Technologies/Extending wikis and blogs/MediaWiki. (2017). In WikiEducator/VirtualMV wiki. Retrieved November 18, 2017, from http://wikieducator.org/VirtualMV/Digital_Learning_Technologies/Extending_wikis_and_blogs/MediaWiki    (zotero)