Extension:ShowMe

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
ShowMe
Release status: beta
Implementation Tag
Description Shows or hides selected elements on the page
Author(s) Ike Hecht (tosfostalk)
Latest version 0.0.1 (January 2017)
MediaWiki 1.27+, possibly earlier
PHP 5.4+
Database changes No
License GNU General Public License 2.0
Download
README
Translate the ShowMe extension if it is available at translatewiki.net
Check usage and version matrix.

The ShowMe extension allows inserting a dropdown into pages, that will show different elements on the page depending on which option is selected.

Installation[edit]

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

Usage[edit]

Use the <showme> tag. It has an optional name parameter, which can set the name and id of the <select> element. Each line between the tags should contain an option. It must consist of the text to be shown, followed by a pipe, followed by the class name of an element (or elements) on the page which should be shown when this option is selected. While one option is selected, the elements corresponding to all other options become hidden. To avoid flashing of elements that are supposed to be hidden, you can optionally add style="display: none;" to every option other than the first.

Example[edit]

<showme>
Text for Option 1|opt-1
And another option|opt-2
</showme>
<div class="opt-1">
Some text shown when clicking the first option.
</div>
<div class="opt-2" style="display: none;">
Here goes the text shown for the second option.
</div>