FANDOM


[edit] [purge] Template-info Template documentation

The Featured image template selects an image from a set of files (one for each day of the year) for presentation on the Forgotten Realms Wiki Main Page. The template is invoked with:

{{Featured image}}

which defaults to the current date (GMT), or with an optional Gregorian calendar date in day month format like so:

{{Featured image|22 April}}

The template selects an image page with the corresponding day number and month from the set of links below. For example, on the 11th of April, the template will select {{Featured image/11 April}}. If there is no featured image for that day, then the template should fall back to the image for the date of the nearest multiple of 7, plus 1. For example, if there is no image for April 11, then it should select {{Featured image/15 April}}. Therefore, please supply images for days 1, 8, 15, 22, and 29 of each month before filling out any other days.

Choosing a featured image

Featured images may be chosen by any user, but are subject to vetting by administrators and may be deleted if not deemed appropriate. Ideally, all featured images should be:

  • From an official canon or licensed Forgotten Realms source and detailing something from the setting, as we want to illustrate the Forgotten Realms.
  • Of good quality with the subject easy to see, to enhance the appearance of the main page, but black-and-white and line-art images are acceptable.
  • Something interesting to look at and showing a complete image.
  • Not too long in the vertical direction, as a tall image will stretch out the Main Page.
  • And be fully detailed via an {{Information}} template, with categories and copyright information included.

Featured images may otherwise come from any source: images in sourcebooks, book covers, scans from comic books, screencaps from games, etc.

Writing a featured image template

After selecting one of the featured image links, the page should be written using the {{Format featured image}} template, filling in the required fields:

{{Format featured image
| image   = [[file:PICTURE.JPG|SIZEpx]]
| caption = A caption describing the image here.
| usethis = all
}}<noinclude>
[[Category:Featured images|{{#sub:00{{#time: z|{{SUBPAGENAME}} 2004}}|-3}}]]
</noinclude>
PICTURE.JPG
The file name of the image to be featured.
SIZE
The width of the image in pixels, large enough to be clearly seen but not unbalancing to the Main Page — 200px or 250px should be fine.
caption
A caption describing the image, with links to the relevant article for the image.
usethis
Must be set to all, AM, or PM (case insensitive). If set to all, the image will appear all day. If set to AM, it will appear in the morning hours (00:00:00 to 11:59:59 GMT). If set to PM, it will appear in the evening hours (12:00:00 to 23:59:59 GMT). Thus, you can put two images on the same page and each will be displayed for half a day. If left blank or set to anything else, the image will not display as a featured image.

The last line, between <noinclude> tags, will place the page in Category:Featured images with a sortkey that is the day of the year, zero-padded to three digits.

Featured image links

Featured image templates should be created at the following links. Please begin with days 1, 8, 15, 22, and 29 of each month to ensure the template functions correctly. If you want to put a specific image on a particular Harptos date, see this list of major dates and the corresponding Harptos dates. To see what image files have already been used, see the Featured image index.

January

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

February

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29

March

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

April

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30

May

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

June

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30

July

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

August

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

September

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30

October

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

November

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30

December

1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Current featured image

Wizard of Turmish-reverse
The Epic Stat Card for a wizard of Turmish.

Under the hood

What follows is a detailed, line by line explanation of how this template works, for those who really want to know. This template uses DynamicPageList (DPL) which is fully documented here. Below is the essential part of the {{Featured image}} template:

1. {{#dpl:
2.   | namespace = Template
3.   | title = Template:Featured image/{{{1|{{LOCALDAY}} {{LOCALMONTHNAME}}}}}
4.   | include = {Format featured image}
5.   | includematch = /\s*usethis\s*=\s*(all¦{{#time:a}})/si
6.   | noresultsheader = {{Format featured image.default|{{{1|{{LOCALDAY}} {{LOCALMONTHNAME}}}}} }}
7.   | allowcachedresults = false
8.   | eliminate = categories,images
   }}
  1. The first line declares we are using DPL in parser function mode (like {{#if:).
  2. This tells DPL to limit its search to only files in the "Template" namespace, meaning all files that begin with Template:.
    • The date files containing the featured images are all in the Template namespace.
  3. For this template, we are searching for one particular file, so we might as well search for it by title. If the template is called with an argument (like {{Featured image|22 April}}), then {{{1}}} is replaced by 22 April. If called without an argument, {{{1}}} is undefined and the default value is substituted instead. Using 22 April for example, the full title of the page we are searching for would be "Template:Featured image/22 April".
    • The default value is the concatenation of the two Magic Words {{LOCALDAY}} and {{LOCALMONTHNAME}} separated by a space. The last time this page (the one you are reading right now) was cached, the default value was 24 May GMT.
  4. Assuming the page was found, this tells what part of the page to fetch and present as the output of this template. We want all {{Format featured image}} templates, rendered just as if they were on the page in place of {{Featured image}}.
  5. If we find one or more {{Format featured image}} templates on the page, then they have to match certain criteria, given by this regular expression, or they will be skipped. In English, the regular expression is looking for possible whitespace, then the word "usethis", followed by maybe more whitespace, an equals sign, yet more optional whitespace, then either the word "all" or the value of the AM/PM field in the current timestamp. If a match is found, then the {{Format featured image}} template is sent to the output and we move on to the next one, if any. Here's a slightly more technical description of the regular expression:
    • The regexp starts and ends with a forward slash, " / ". The "s" at the end specifies that the parser should consider newline characters as whitespace (which means, for example, that "usethis" and "=" don't have to be on the same line in the "22 April" file. The "i" at the end specifies that all string comparisons should ignore case (which means you can write "useThis = PM" if you want).
    • "\s" is shorthand for "whitespace" and the " * " means "zero or more of these". So "\s*" matches any amount of whitespace (including newlines because of the trailing "s") or no spaces at all (so you can write "usethis=AM" if you want).
    • Next it tries to match the string "usethis" (ignoring case due to the trailing "i").
    • Match "\s*" for zero or more whitespace.
    • Match an equals sign " = "
    • Match "\s*" for zero or more whitespace.
    • The left parenthesis, " ( " starts a subpattern. We can match any of the things inside the parentheses. They are separated by the broken pipe symbol, " ¦ " which performs a logical OR function. Normally, regular expressions use the pipe symbol, " | " here, but since templates use the pipe to separate parameters, it would confuse the parser, so we use the broken pipe instead.
    • The first optional subpattern match is the word "all".
    • The second optional subpattern is the current AM/PM indicator as given by {{#time:a}}. So whenever the {{Featured image}} template is called, {{#time:a}} will be replaced by either "am" or "pm" depending on whether it is before noon or after noon, GMT. The last time this doc page was cached, it was pm.
    • The right parenthesis closes off the subpattern.
    • The last forward slash closes off the regexp, leaving the "si" which we discussed earlier. We're done!
  6. This line tells DPL what to do if the file matching the title does not exist—we call {{Format featured image.default}} with either the value of the parameter {{{1}}} ("22 April" in our example), or the current day month pair, if we didn't specify a date. The .default template will compute the nearest day that is a multiple of 7, plus 1, and try again. Right now, it computes 22.
  7. This tells DPL to ignore any cached results (which might be stale by a few hours) and return fresh results.
  8. And finally, this command tells DPL to remove any categories from the included code and remove references to any images before sending the output to the page that called this template. Otherwise, the calling page would be put in whatever categories had been assigned to the {{Format featured image}}, and the "What links here" report for any images included would show that the calling page linked them, which is not true.


Community content is available under CC-BY-SA unless otherwise noted.