Extension:Variables/fr

L'extension Variables vous permet de définir une variable sur une page, de l'utiliser ensuite dans cette même page ou dans des modèles inclus dans la page, de changer sa valeur, notamment en utilisant son ancienne valeur, etc.

It is much like a template, only very lightweight and scoped to only a single page, so you can use many variables on a page without slowing down the wiki with huge numbers of templates. Combine this extension with the ParserFunctions extension for best results.

Assigns the value specifiedvalue to the (already existing or hereby introduced) variable variablename.


 * Example:  making iconwidth = 25

Works exactly as, but the affected value is printed.


 * Exemple: making iconwidth = 

La valeur de la variable variablename est obtenue par Si cette variable n'est pas définie, ceci renvoie une chaînevide, sans générer de message d'erreur.

Il est possible de définir une valeur pour le cas où la variable est vide ou non définie.



Ceci est équivalent à:

but it is much shorter and better arranged. Before version 2.0 though, the default value always was expanded. From version 2.0 on the default only gets expanded in case it is actually used.

The value can be used in parser functions, etc.


 * returns 1 if the variable is already defined. If the variable is not defined the return value is void.

It supports a second and a third parameter to replace these values.

This is equivalent to:

but it is much shorter and better arranged. Before version 2.5 though, both were always expanded. From version 2.5 on the if and else values only get expanded when their cases are actually entered.

Experimental new function introduced in Variables 2.0. This function will output the final, last value a variable has at the end of the page rendering. Naturally, the value will be inserted after the parser went over the entire wiki markup, so this function can't be used in other functions, expecting the right value is being used. Example:

The default value will be used if the variable doesn't exist at the final page rendering stage or if its value is an empty string. The default will be expanded right where the function is used, so the parameter will be expanded, even if it won't be needed.

Exemples
The ParserFunctions extension must also be installed to use #expr.

Compute : Add one to n:

Configuration
This extension provides two configuration parameters:
 * Allows to disable the parser frame being marked as volatile by the extension, i.e. disable template caching.
 * Default:
 * Default:


 * Allows to disable specified parser functions provided by this extension.
 * Default:
 * Example:
 * Example:

Compatibility
The recommended version of the Variables extension for recent MediaWiki releases is listed below. Older versions of the extensions might work as well, but aren't tested for new MediaWiki releases.

Alternatives
As this extension will not be enabled for wikis run by the Wikimedia Foundation (WMF)  , here are some alternatives:


 * If you use Variables as cache for expensive operations, you can transform the section where you need them into a template and pass the required information as template parameters instead. This will work until you reach the expansion depth limit.
 * Si vous utilisez des Variables pour effectuer des opérations de modèle plus complexes que possible avec des ParserFunctions simples, vous pouvez utiliser la fonctionnalité Lua de Scribunto. Notez que cela n’ajoute pas la prise en charge des Variables globales. Cependant, ajoute une interface Scribunto pour le magasin de Variables.
 * Don't use variables, instead duplicate the information you need as a variable. If that information is acquired by an expensive template call, performance may suffer. This will work until you reach the node count limit.

Voir aussi

 * - Creates new variables in the MediaWiki sense
 * - Provides parser functions for performing loops
 * - Create an array and provide array functions (such as search, split, and sort) and set operations (such as intersect, union and diff)
 * - New parser functions for handling hash tables in MediaWiki
 * - New parser functions for handling hash tables in MediaWiki