W3TPL/tag/get-let
Jump to navigation
Jump to search
About
The <get> and <let> tags are very similar, and can do similar things, even though in a way they are opposite operations.
- get:
- retrieves an input or stored value and (ultimately) outputs it to the display.
- The result is always displayed (though this can be captured and/or hidden by enclosure within another tag).
- does not require a
name=
attribute. - is like <let> with
echo
andself
assumed, except it doesn't store the result.
- retrieves an input or stored value and (ultimately) outputs it to the display.
- let:
- receives an input value and (ultimately) stores it as a variable.
- The result is always stored in a variable (though it can also be displayed with
echo
).
- The result is always stored in a variable (though it can also be displayed with
- requires a
name=
attribute. - if
echo
andself
are used, is like <get> except it stores the result in a named variable.
- receives an input value and (ultimately) stores it as a variable.
Attributes
Each attribute is processed within a given stage, where stages are processed in essentially this order:
GetTagInput()
:- (input) = input stage (determining where the input value should come from, and retrieving it)
UseTagInput()
:- (calc) = doing things with the retrieved input. The output of each operation becomes the input for the next.
- Note that we can't really count on MediaWiki's parser preserving the order of attributes within a tag, however.
- (output): = putting the results other places besides the target variable
- (calc) = doing things with the retrieved input. The output of each operation becomes the input for the next.
The following attributes are common to both get
and let
:
- append (calc): append the input string to the current value
- arg= (input): name of $wgRequest (POST or GET) field to retrieve as tag input
- USAGE: form processing
- chr= (input): ASCII number of character to use as tag input
- copy= (input): name of another variable whose value should become the input
- lcase (calc): apply
strtolower()
, i.e. convert the input to lower case- opposite of "ucase"
- lcfirst (calc): apply
lcfirst()
, i.e. convert the first character of the input to lower case- opposite of "ucfirst"
- len= (calc): use only the first <len> characters of the input (this could probably stand some rethinking)
- newline (calc): appends a newline ("\n" in PHP) to the string (FUTURE: some way to prepend it; some way to prepend/append other short strings)
- parse (calc): have MediaWiki parse the input, and use the resulting string
- pre (calc): alias for "parse", for backwards compatibility
- trim (calc): apply
trim()
- ucase (calc): apply
strtoupper()
, i.e. convert the input to upper case- opposite of "lcase"
- ucfirst (calc): apply
ucfirst()
, i.e. convert the first character of the input to upper case- opposite of "lcfirst"
- val= (input): value/expression to use as input; can be sysdata.