Open main menu

Extension:SelectTag

MediaWiki extensions manual
Crystal Clear action run.svg
SelectTag
Release status: stable
Implementation Parser function
Description Adds customisable <select> for inserting text via database fetching.
Author(s) Khaled El Mansourytalk
Latest version 1.0.3 (2012-08-19)
Database changes No
License GPL v3+
Download
README
Example ExpressProgs TestWiki
Parameters
$wgSelectTag
Tags
<select>
Hooks used
ParserFirstCallInit
Translate the SelectTag extension if it is available at translatewiki.net
Check usage and version matrix.

The SelectTag extension that can be used for embedding any kind of text (incl. HTML) into a wiki page via a new tag <select> tag. It selects the data to be displayed from a database table in the same database as MediaWiki is installed in.

It is fully customisable via the LocalSettings.php file to include as many attributes as needed.

Download & InstallationEdit

  1. Download the latest version via the "(Git master)" link above
  2. Extract the tar.gz file, rename the included folder to SelectTag and upload it to /extensions/
  3. Place the following code at the end of your LocalSettings.php file:
    require_once( "$IP/extensions/SelectTag/SelectTag.php" );
    
  4. Successful installation can be verified through the Special:Version page

ConfigurationEdit

A much more detailed step-by-step configuration as well as a Demo can be found at the following URL: http://www.expressprogs.com/products/mwext/selecttag/

LocalSettings.php

$wgSelectTag[ 'examplesource' ][ '_dbname' ] = 'exampletbl';
$wgSelectTag[ 'examplesource' ][ 'attr1' ] = 'field1';
$wgSelectTag[ 'examplesource' ][ 'attr2' ] = 'field2';
$wgSelectTag[ 'examplesource' ][ 'attr3' ] = 'field3';
$wgSelectTag[ 'examplesource' ][ '_show' ][ 'show1' ] = 'field4';
$wgSelectTag[ 'examplesource' ][ '_showDefault' ] = 'show1';

Page

<select _source="examplesource" arr1="value1" arr2="value2" arr3="value3" _show="show1" />

Resulting SQL query

SELECT field1, field2, field3 FROM exampletbl
WHERE arr1='value1' AND arr2='value2' AND arr3='value3';

See alsoEdit