From TestWiki
Jump to: navigation, search

The WikiDebug extension adds a new parser hook that allows you to change the page content depending on whether an extension has been installed on the wiki.


{{#IfExtensionPresent: ExtensionName | Output if present | Output if not present}}
  • ExtensionName is the name of the extension, as registered in $wgExtensionCredits. This is the name as displayed on Special:Version. Note that this parameter is case-sensitive!
  • The first parameter is the wikitext to be output if the extension is present.
  • The second parameter is the wikitext to be output if the extension is not present.

Any wiki syntax that is usually allowed within parser functions is allowed. As with all parser functions, white-space at the start and end of a parameter is automatically stripped. You may omit the final parameter (including the pipe symbol) if not required.


Result when extension exists[edit]

{{#IfExtensionPresent: WikiDebug | WikiDebug is installed. | WikiDebug is not installed.}}

Output: WikiDebug is installed.

Result when extension doesn't exist[edit]

{{#IfExtensionPresent:WikiMadeUp|Amazingly, WikiMadeUp is installed, despite being made up!|WikiMadeUp is clearly made up.  It is not installed.}}

Output: WikiMadeUp is clearly made up. It is not installed.

Only one argument[edit]

Useful to hide the unparsed wikitext in cases when an extension may not be present (e.g. if the page may be exported to another wiki).

{{#IfExtensionPresent: WikiDebug|<show_version file="WikiDebug.php" />}}

Output: (rev 2047)

However, remember that the extension name is case-sensitive!

{{#IfExtensionPresent: wikidebug | <show_version file="WikiDebug.php" />}}