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|
|License||GNU General Public License 2.0 or later|
|Translate the Did You Know extension if it is available at translatewiki.net|
|Check usage and version matrix.|
|Issues||Open tasks · Report a bug|
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.28 or above
- PHP 5.2 or above
The extension can be retrieved directly from Git [?]:
- Browse code
- Some extensions have tags for stable releases.
- Browse tags
- Select the tag
- Click "snapshot"
- Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).
- Browse branches
- Select a branch name
- Click "Continue"
Extract the snapshot and place it in the extensions/DidYouKnow/ directory of your MediaWiki installation.
If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:
cd extensions/ git clone
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
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.