List of simple extensions
This page is outdated. It was written for an older version of MediaWiki and may not apply to the most recent version. If you have checked or updated this page and found the content to be suitable, please remove this notice. .
Beginning developers may wish to watch this intro video (slides) and browse the list of simple extensions when considering how to create a new extension. Some of the code from these extensions can provide insight into how to approach an implementation task, or even be cannibalized for your purposes.
You may want to include a licensing statement at the beginning of your extension file, e.g.:
/* * @author Your Name <firstname.lastname@example.org> * @copyright Copyright © 2012, Your Name * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */
Another way to do it is like this:
/** * NameOfYourExtension * * Copyright © 2012 Your Name <email@example.com> * https://www.mediawiki.org/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @file */
- ErrorPage: Example of the page that uses extensions hooks DBConnectionErrorRaw and DBQueryErrorRaw for making nice error page.
- Example: This is an example extension. It doesn't actually do anything useful, but can be copied to provide the basis for your own extension.
- MyExtension FourFileTemplate: Four-file special page extension template.
- HelloWorld: A special page that says "Hello World!" in the appropriate language.
- Parser_hook: A parser hook example, use it on a page like
<hook arg1="foo" arg2="bar" ...>input</hook>
- Variable_hook: An example parser hook that defines a new variable,
- Manual:Special_pages#Basic_special_page_template provides an example of a four-file Special Page extension called
MyExtensionthat outputs "Hello world!" Don't forget the standard collection of special pages in includes/specials, the functionality of some of which you may already be familiar with.
- Awesomeness is a simple API and ArticleSave extension.
- BypassSearch, which adds a user preference.
- PatchOutput uses the OutputPageBeforeHTML hook to apply some patches to the HTML code of a page before it is displayed
- If you are checking this out from SVN and intend to copy it, please use:
svn export /path/to/this/extension /path/to/new/extensionto create a clean copy without any extra SVN cruft.