Extension:MoveToSkin

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
MoveToSkin
Release status: unmaintained
Implementation Parser function, Skin
Description Allows to move content from a page to the skin
Author(s) Andru Vallance (andrujhontalk)
Latest version 0.1.2 (2012-11-05)
MediaWiki 1.19+
PHP 5.3+
Database changes No
License GNU General Public License 3.0 or later
Download
README
Tags
mywiki
Hooks used
ParserFirstCallInit
LanguageGetMagic
ParserAfterTidy
Translate the MoveToSkin extension if it is available at translatewiki.net
Check usage and version matrix.

The MoveToSkin extension allows skin designers to specify areas of the skin which can hold content defined within the Wiki article. By using the parser function {{#movetoskin}}, content defined in the article body can be moved to anywhere in the skin without relying on clientside Javascript.

Installation[edit]

  • Download and place the file(s) in a directory called MoveToSkin in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MoveToSkin/MoveToSkin.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

Wiki page[edit]

In your articles, use the parser function {{#movetoskin:target|content}}.

  • The first argument, *target* is a unique name you can use in the skin to show this content.
  • The second argument *content* is the content you want to move.

You can use the same target mutiple times.

Skin code[edit]

Use the static method MoveToSkin::getContent() in your skin to grab an array of all the content, indexed by target name. You can then use this to output the content wherever you choose. Eg.

$content = MoveToSkin::getContent();
	if(isset($content['target name'])){
		foreach($content['target name'] as $c){
			echo '<div class="something">'.$c.'</div>';
		}
	}