Extension:Did You Know
Did You Know
Release status: experimental
|Description||Adds display() function that displays an "Did You Know?" box for a random article in the category.|
|Author(s)||Jeroen De Dauw|
|MediaWiki||1.18.0 or higher|
|PHP||5.2 or above|
|License||GNU GPL v2+|
|Check usage and version matrix|
|Bugs: list open list all report|
This extension allows for displaying a "did you know" box in articles (using some wikitext construct) and other interfaces such as special pages (by using the PHP interface from another extension).
The did you know (DYK) box consists of a header "Did you know... ?", followed by content pulled from a wiki page. The wiki page gets randomly selected from a list of pages within a certain category (this category can be configured in LocalSettings). A "type" parameter can also be provided, which causes the lookup for the page to happen in a different category, for example [[Category:Did you know/$type]], where $type gets replaced by the value of the type parameter. If there are no pages in this category, the selection mechanism falls back to the default category.
Did You Know requires:
- MediaWiki 1.18 or above
- PHP 5.2 or above
You can download the extension directly from the MediaWiki source code repository (browse code). You can get:
- One of the extensions tags
Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag
- Go to the tags list
- Click the name of the tag you want to download
- Click "snapshot"
- The latest version of one of the extensions branches
Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.
- Go to the branches list
- Click the branch name
- Click "snapshot"
- A snapshot made during the release of a MediaWiki version.
This might be unstable and is not guaranteed to work with the associated MediaWiki version.
After you've got the code, save it into the extensions/DidYouKnow directory of your wiki.
If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:
cd extensions git clone
Once you have downloaded the code, place the DidYouKnow directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file:
# DidYouKnow require_once( "$IP/extensions/DidYouKnow/DidYouKnow.php" );
This is a copy of the release notes file on GIT, which might be more up to date then this page.
Did You Know is fully internationalized. Translation of Did You Know messages is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.