Extension:UrlGetParameters

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
UrlGetParameters

Release status: stable

Implementation Parser function
Description Provides a parserfunction {{#urlget:...}} which allows access to the url parameters in your page. Note: caching for the page you use this extension on should be disabled.
Author(s) S.O.E. Ansems
Last version 1.2 (2011-03-02)
MediaWiki 1.10.x or higher
License No license specified
Download Download snapshot
Subversion [Help]

Browse source code
View code changes

Check usage (experimental)

This extension enables you to use and/or display the "GET" parameters of the URL, i.e. the query string, on the wiki page.

Contents

[edit] Installation

  1. Download from the extension distributor above, and unzip into $IP/extensions
    Note: $IP is your MediaWiki install dir.
  2. Enable the extension by adding this line to your LocalSettings.php:
    require_once( "$IP/extensions/UrlGetParameters/UrlGetParameters.php" );
    

[edit] Usage

To display the value of a URL get parameter in your page, you might do this:

{{#urlget:parameter-name}}

Where parameter-name is the name of the parameter whose value you want. If the parameter is not found, the extension will result in nothing. Alternatively, you can also specify a default value as follows:

{{#urlget:parameter-name|default-value}}

When the parameter parameter-name is not available, then the value default-value is returned.

If the URL contains parameters of the form "A[B]=C", you can display the value "C" in a similar way, by calling:

{{#urlget:A[B]}}

[edit] Authors

This extension was written by S.O.E. Ansems. Important contributions were made by Ankit Garg and some anonymous editors.

[edit] Version history

  • 1.0 - February 21, 2008 - initial version
  • 1.1 - February 15, 2011 - page caching disabled; handling added for array parameters; security fix added using rawurlencode()
  • 1.2 - March 2, 2011 - Code tidy up, improve hook calls
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox