Template:File
This template in most cases is transcluded with one file, but it is able to display an unlimited number of files.
This template finally uses Template:F, which can be customized with many parameters.
Two kinds of parameters can be used for that customizing:
- global parameters, which are valid for each file, as long they are not suppressed or overriden by
- individual parameters, which are valid for only one of the files, whose number is specified.
A parameter is either specified (with a value), or not (when not coded, or without a value).
Specified global parameter values can be individually:
- kept valid, by not specifying an individual parameter;
- suppressed, with an individual value specified empty;
- overriden, by an individual value specified.
An empty specified individual parameter for a not specified global parameter is useless but will not disturb.
An individual parameter with a number exceeding that of the specified files is useless but will not disturb.
Some parameters format the file display layout; when no display occurs, their specification is useless but will not disturb.
Usage
{{File |1= }}
Template parameters
Parameter | Description | Default | Status | |
---|---|---|---|---|
1 | File name of the image (with or without namespace). | optional | ||
2, 3, ... n | names of more files; for each empty parameter, the name of parameter 1 is used | empty | optional | |
lab or l | (Global display label for files) normally not useful if more than 1 file individual parameter(s) | empty | optional | |
dis or d | Global pixel size value, to display the image. See also the parameter "z" individual size parameter{s} | empty | optional | |
opt or o | Global additional option for {{F}}, like "l" (left) or "b" (bordered) individual option(s) | empty | optional | |
par4 or q | Global 4th parameter for {{F}}, like "n" (nolink) or "+" or "-" individual more parameter(s) | empty | optional | |
par5 or r | Global 5th parameter for {{F}} individual more parameter(s) | empty | optional | |
wiki or k | Global ISO 639-1 code for a Wikipedia sisterproject individual code parameter(s) | empty | optional | |
inter or i | Global ISO 639-1 code for SVG switch internationalization individual code parameter(s) | empty | optional | |
pfx or x | Global code prefixing the file individual prefix parameter(s) | empty | optional | |
t1 ... tn | individual postfix text parameter(s) (does not exist globally) | empty | optional | |
by or b | Global author name individual author name(s) | empty | optional | |
mod or m | Global code for modification of the user link(s) individual modifications (as t , w , wt ) | empty | optional | |
conj or c | specify c[on[j]]=n to suppress the commas and the final 'and' in the list | empty | optional | |
vary or v | a parameter list for variations is used | empty | optional | |
v1 and v2 | Global pre- and postfixes for variations | empty | optional | |
spa or s | Global code for an intermediate space for variations : "+" for a space, else noneindividual codes | empty | optional | |
gallery | set to "yes" for a gallery layout: see {{G}} for gallery parameters The characters for the individual parameter codes won't conflict with them for galleries. | empty | optional |
Additional information
The template is intended to be used in the following namespaces: no namespace specified
The template is intended to be used by the following user groups: no user group specified
See also
There are currently five templates creating file lists with the function:filelist
of the Module:Iteration
- Other versions a vertical list (without initial)
- Derivative versions a vertical list
- Derived from a vertical list
- Filelist a horizontal list (without initial)
- File a horizontal list
All these templates are autoreferencing, and they support also the "gallery" option.
Examples
{{ File | a.png | b.png }} will give
{{ File | a.png | e.png }} will give
{{ File | a.png | e.png | × }} will give
- Abbreviation
In simple cases the |by=
can be abbreviated with /
:
{{ File | Example.jpg/Example | example.svg/Extra }}
renders as
Pseudo filenames
Normally the parameters 1 ... n specify file names. Some special functions are performed with parameters not specifying real file names;
but all parameters are counted, regardless whether they are real filenames or not. With e.g. the pseudo-filename "×" at the last position the and
can be converted to a ,
.
Display text
When a parameter is specified starting and ending with "
("
sign "
) the text between the two quotes is displayed.
Variations
The function supports for series of files with names differing only in one part, as it should be in well designed file systems; see the three examples below.
The variation option is triggered with the parameter "vary" or "v" specifying the pattern that should be replaced.
- The first file name parameter is not a real file name, it contains the pattern which will be replaced by the following strings.
- All the other file name parameters are not real file names but the strings replacing the pattern; an empty parameter just removes the pattern.
Specially for variations (but not only) the shortcut parameter "z" is useful: it specifies the display size (like "d"), and sets in addition the "o=Z
" and "p= 
", when they are not specified otherwise: a |p=
specification overwrites the |z=
option:
Variations: single replacements
Each parameter (except the first one) is combined with the first parameter to generate an existing filename.
- Example
- {{ File | vary = ? | z = 48 | Pictogram reply?.svg | "Replies: " | blue | green | soft green }} gives:
Variations: loop replacements
For series of files where the variated part is a number, it is possible to specify in one parameter the starting and the ending number, to generate all the file names - without any limit.
Loop replacements are specified with a parameter starting with a "#", followed by the first number, another "#" followed by the second number and ending with another "#".
The second number (the upper limit) must not be less than the first number (the lower limit). When any error occurs, no looping is done.
- Example
- {{ File | v = xx | z = 20 | State Highway xx NZ.svg | " 1st: " | #1#8# | " 2nd: " | #20#41# | " 3rd: " | #56#60# }} gives:
In such a way, hundreds of files can be displayed with few parameters, e.g.
- {{ Fl | v = # | z = 12 | Bundesstraße # number.svg | #1#113# }} gives:
- Syntax
- {{ File | filename 1 | filename 2 | filename 3 | ... }} unlimited, with possibly some other display names:
- {{ File | filename 1 | filename 2 | filename 3 | ... | l1 = displayname 1 | l2 = displayname 2 | ... | l23 = displayname 23 }}
- Parameters
- {{ File | Red.svg | d = 14 }} →
- {{ File | Red.svg | Solid blue.svg }} →
- {{ File | Red.svg | Solid blue.svg | Solid yellow.png | d2 = 12 }} →
- Etc., parameters without any limit.
- {{ File | Augsburg Tram 1.svg | Augsburg Tram 2.svg | Augsburg Tram 3.svg | Augsburg Tram 4.svg | n2 = № 2 | n3 = № 3 | n4 = № 4 }} →