Extension:Variables/es

La extensión Variables permite definir una variable en una página, usarla más tarde en esa misma página o en las plantillas incluidas, cambiar su valor, posiblemente a un valor dado por una expresión en términos del valor anterior, etc.

Semejante a un "template" o "plantilla", más ligero y su alcance es una página. Te permite emplear múltiples variables en una página sin impactar el desempeño de la wiki, como sucede cuando se maneja un gran número de plantillas. Combina esta extensión con la extensión ParserFunctions para mejores resultados.

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


 * Example:  making iconwidth = 25

#vardefineecho
Works exactly as #vardefine, but the affected value is printed.


 * Ejemplo: making iconwidth = 

#var
The value of the variable variablename is produced by If undefined, this produces an empty string; it does not give an error message.

It is possible to define a value for the case that the variable is undefined or void:



Esto es equivalente a:

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.

#varexists

 * returns 1 if the variable is already defined (also when the value is a void string). If the variable is not defined the return value is void.

#var_final
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.

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

Compute : Agregar uno a n:

Véase también

 * Extension:Foxway Use the syntax and power of PHP in wiki pages
 * Extension:DynamicFunctions##arg:
 * Extension:MyVariables - Creates new variables in the MediaWiki sense
 * Extension:Loops - Provides parser functions for performing loops
 * Extension:Arrays - Create an array and provide array functions (such as search, split, and sort) and set operations (such as intersect, union and diff)
 * Extension:HashTables - New parser functions for handling hash tables in MediaWiki