Extension:My list

From MediaWiki.org

Jump to: navigation, search

   

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
My list

Release status: beta

Description Used as a memory list.
Last Version  0.1
License No license specified
Download no link

check usage (experimental)

Contents

[edit] What can this extension do?

This extention can be used to draw a memory list. You can add some priority tags.

!!! This extension DO NOT use any DB.

[edit] Usage

Tags are : <my_list (parameters...)>(contents...)</my_list>.

Parameters :

  • "title=name_of_title" is used to set a title to the list. Default : "My Checklist";

Contents :

  • Every elements of the list have to be inserted between '[' and ']'.
  • You can add a priority tag (1#) just after the '['. The priority tag will insert the element on the top

of the list with red background.


[edit] Download instructions

Please cut and paste the code found below and place it in $IP/extensions/my_list/my_list.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

[edit] Installation

To install this extension, add the following to LocalSettings.php:

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/my_list/my_list.php");

[edit] Configuration parameters

[edit] User rights

[edit] Code

<?php
/******************
http://aiantis.net
Author : Fricky
Version : 0.1 Beta
 
!!!!! This extension do not use MySQL db. !!!!!!!
 
DESCRIPTION
-------------
List is a very basic extension used as a memory list.
 
USAGE
------
Tags are : <my_list (parameters...)>(contents...)</my_list>.
 
Parameters : 
** "title=name_of_title" is used to set a title to the list. Default : "My Checklist";
 
Contents :
** Every elements of the list have to be inserted between '[' and ']'.
** You can add a priority tag (1#) just after the '['. The priority tag will insert the element on the top
of the list with red background.
 
 
EXAMPLE
--------
<my_list title=pikachu>
[1#one]
[two]
[1#three]
[four]
</my_list>
 
*********************************************************/
$wgExtensionFunctions[] = "my_List";
 
function my_List() {
        global $wgParser;
        $wgParser->setHook( "my_list", "build_list" );
        $wgParser->disableCache();
}
 
function build_list ( $input, $argv=array() )
{
	$count = 1;
	if ($argv['title'] != NULL)
		$title = $argv['title'];
	else
		$title = 'My check list :';
	$temp = explode('[', $input);
	while ($temp[$count] != NULL)
	{
		$content = explode(']', $temp[$count++]);
		$check = explode('#', $content[0]);
		if ($check[0] == '1')
			$str .= "<div style='background:#ffd1d1'><input type='checkbox'>" . $check[1] . "</div>";
	}
$count = 1;
	while ($temp[$count] != NULL)
	{
		$content = explode(']', $temp[$count++]);
		$check = explode('#', $content[0]);
		if ($check[0] != '1')
			$str .= "<div><input type='checkbox'>" . $content[0] . "</div>";
	}
	$str = "<table style='border:1px solid #e3e3e3'><tr><td><h3>" . $title . "</h3></td></tr><tr><td>" . $str . "</td></tr></table>";
	return $str;;
}
 
 
 
 
?>

[edit] See also